【发布时间】:2018-08-12 18:39:58
【问题描述】:
我用 ggplot2 创建了一个 ggplot。该图是一年的时间序列测量,我已经组织了几个月。 这是我的代码:
ggplot(data = mydataframe, aes(x = time)) +
geom_point(aes(y = H_flux_6262_R3, color = "6262-R3"),
alpha = 0.5,
shape = 19) +
geom_point(aes(y = H_flux_7200_HS, color = "7200-HS"),
alpha = 0.5,
shape = 5) +
geom_point(
aes(y = H_flux_dif_6262_R3_7200_HS, color = "Difference"),
alpha = 0.5,
shape = 5
) +
facet_wrap( ~ Month, nrow = 3) +
theme(text = element_text(),
axis.text.x = element_text(angle = 60, hjust = 1)) +
theme(legend.position = "right", legend.title = element_blank()) +
scale_color_manual(values = c("#56B4E9", "#E69F00", "palegreen4")) +
labs(x = "time", y = "H flux")
我的时间格式是:%H:%M:%S,比如00:00:00。
H flux 6262_R3 H_flux_7200_HS Time
100 500 02:00:00
400 700 02:30:00
400 700 03:00:00
400 700 03:30:00
400 700 04:00:00
100 500 04:30:00
400 700 05:00:00
400 700 05:30:00
400 700 06:30:00
400 700 07:00:00
以此类推,直到 00:00:00。 我每 30 分钟测量一次我的数据。当我绘图时,我遇到的问题是它不会将其缩放到例如每 4 小时一次,因为我不需要它们,所以没有秒数。我已经用很多不同的方法尝试过它,它就是行不通。我现在很绝望,对不起。 Mabye有人可以帮助我吗?我会很感激的!
【问题讨论】:
-
谢谢!我也用那个代码试过了,但它仍然不起作用。对不起,你能不能给我更多的线索?
-
请分享您的数据,以便其他人可以提供帮助。在此处查看更多信息How to make a great R reproducible example?
-
完成!感谢您的评论!
-
dput(mydataframe)会更好。如果太长,请尝试dput(head(mydataframe, 50))