我试图绘制三个变量,并希望轴标签中的单位,但无法找到一种方法来标记它们与上标的方面。
我尝试过as_labeller
,label_bquote
,expression
/ paste
并更改原始数据。
p <- ggplot(data = LST, aes(x = Date, y = Measurements)) +
geom_point((aes(color = parameter)))
p + facet_grid(parameter ~ ., scales = "free_y",
switch="y",labeller=as_labeller(DO~(mg~L^{-1}), Temperature~(°C), Light~
(µmol~m^{-2}~s^{-1}))) +
theme_bw()+ theme(strip.background = element_blank(),
legend.title = element_blank(), strip.placement = "outside",
panel.grid.minor = element_blank()) +
scale_x_datetime()+ ylab(NULL) +ggtitle("Spring 2018") +
scale_colour_manual(values=c('royalblue1', 'springgreen4', 'darkblue')) +
theme(legend.position="none")+
theme(strip.text=element_text(size=10))
我尝试的所有内容都标记所有方面相同或不放置上标。我在ggplot2
很新,所以我不确定我的尝试是否会有所帮助。