我有下面的情节:
并且我想要改变x轴标签,以便我具有“May”而不是“Mai”(优选的),或者如果失败,则诸如“14-05-21 18:00”之类的标签,其中给出完整的日期和小时。
我用于绘图的代码是:
library(ggplot2)
library(grid)
ggplot(day5, aes(datetime)) +
geom_line(aes(y = ET.Lys, colour = "ET.Lys")) +
geom_line(aes(y = ET.PM, colour = "ET.PM"))+
scale_y_continuous(breaks=c(0,0.2, 0.4, 0.6, 0.8, 1, 1.2), limits=c(0,1.2)) +
xlab("\n date and time") +
ylab("ET [mm/h]\n") +
theme_bw(25)+
theme(legend.title=element_blank(),
legend.justification = c(1, 1), legend.position = c(1,1),
legend.background=element_rect(color = "grey",fill = "white", size = 0.1, linetype = "solid"),
legend.key = element_blank(),
legend.text=element_text(size=20))+
geom_line(aes(y = ET.Lys, colour = "ET.Lys"), size=1)+
geom_line(aes(y = ET.PM, colour = "ET.PM"), size=1)+
theme(plot.margin=unit(c(0.5,2,0.5,0.5), "cm"))
x轴上的datetime变量具有类
> class(day5$datetime)
[1] "POSIXct" "POSIXt"
格式为
format="%Y-%m-%d %H:%M:%S", tz="Etc/GMT+0"
有什么想法吗?
1条答案
按热度按时间fjaof16o1#