我想知道是否有人知道如何在geom_smooth行中使用不同的颜色,而不是选择用于绘制geom_points的颜色。
p3 <-
ggplot(StemSoil, aes(DOYc, CO2, col = as.factor(Port), cex = 1)) +
geom_point(na.rm = TRUE, size = 1) +
geom_smooth(
method = 'loess',
span = 0.1,
size = 1,
na.rm = T,
se = F
) +
scale_color_manual(values = c("red", "steelblue3", "gray20")) +
geom_hline(yintercept = 0,
linetype = 2,
size = 0.5) +
#ggtitle("CO2 flux") +
ylim(0, 20) +
xlab("Date") +
ylab(bquote('CO'[2] ~ 'flux (' * mu ~ 'mol' ~ CO[2] ~ m ^ -2 ~ s ^ -1 *
')')) +
theme_bw() + theme(panel.grid = element_blank()) +
theme(
legend.position = "none",
axis.text.x = element_blank(),
axis.title.x = element_blank(),
axis.ticks.x = element_blank(),
axis.title = element_text(size = 10),
plot.margin = unit(c(-1.1, 1, 1, 1), "cm")
)