[英]Plot with R - labels on x axis
我將以下代碼用於每日天氣:
library(ggplot2)
options(repr.plot.width=16, repr.plot.height=9)
ggplot(df,aes(x = Date, y = MADRID)) +
geom_line(group = 1, color='lightblue')+
scale_y_continuous(limits = c(5,30), breaks = seq(5,30,5)) +
ggtitle ("Daily average temperature - MADRID") +
xlab("Date") + ylab ("Average Temperature ( ºC )")
並得到這樣的圖表:
我的問題是,如何獲得在 x 軸上具有每日數據的年份的標簽?
添加類似:
plot + scale_x_date(labels = date_format("%d/%m/%Y"), breaks = date_breaks("1 year"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.