0
我使用ggplot2和闪亮来创建图形,但是x轴上显示的因素太多。闪亮/ R:线图上的因素太多
output$housePlot <- renderPlot({
ggplot(data=houseratio, aes(x=Year, y=Ratio, group=Region, colour=Region)) +
geom_line() +
geom_point()
})
我试着读这post,但我不能让SEQ()的权利。我的数据是在长格式,如下所示:
Year Ratio Region
1983 Q1 2.9 Northern
1983 Q2 3 Northern
1983 Q3 3.1 Northern
1983 Q4 3 Northern
...
2015 Q2 5.1 UK
2015 Q3 5.1 UK
2015 Q4 5.2 UK
2016 Q1 5.2 UK
使用此代码:
output$housePlot <- renderPlot({
ggplot(data=houseratio, aes(x=Year, y=Ratio, group=Region, colour=Region)) +
scale_x_discrete(breaks = seq(1, 1864, by = 4)) +
geom_line() +
geom_point()
})
所有因素消失!
我只需要每一年的表现,而不是单独的宿舍。有什么建议么?
(感谢)
尝试'scale_x_date'或'scale_x_datetime' http://docs.ggplot2.org/current/scale_date.html –