【发布时间】:2021-10-25 19:18:01
【问题描述】:
我正在尝试创建一个随时间变化的某些天气状况的 2x2 刻面图,但在为某些刻面标题添加度数符号和上标时遇到了麻烦。
weatherPLOT = data.frame(weather = rep(c("Soil Temperature (C)",
"Snow Depth (m)",
"Air Temperature (C)",
"Discharge (m3/sec)"), each = 366),
day = 1:366,
mean = 3, # Obvious place holders,
Lo95 = 2, # Are actual numbers in real code
Hi95 = 4)
ggplot(aes(y = mean, x = day), data = weatherPLOT) +
geom_ribbon(aes(ymin = Lo95, ymax = Hi95), alpha = 0.25) +
geom_path(size = 1) +
theme(axis.title.y = element_blank()) + xlab("Julian Day") +
facet_wrap( ~ weather, nrow = 2, ncol = 2, scales = "free")
我知道诀窍是在 facet_wrap 中使用 labeller,但我无法让它工作 - 我只是想在 (C) 之前添加一个度数符号并制作 3 in (m3/sec)上标。
【问题讨论】:
标签: r ggplot2 facet-wrap