r - ggplot2中的多个样条线 - 想要手动控制颜色
问题描述
例子;
library(dplyr)
library(ggplot2)
library(mgcv)
# Summer
Summer <- mgcv::gamSim(eg=5,n=40000,dist="normal",scale=0.6,verbose=TRUE) %>%
mutate(x = x2 * 20) %>%
rename("Estação" = x0) %>%
mutate(Estação = ifelse(Estação == "1", "Inverno", Estação)) %>%
filter(.,Estação == "Inverno") %>%
select(y, x, Estação)
# Winter
Winter <- mgcv::gamSim(eg=5,n=50000,dist="normal",scale=1.0,verbose=TRUE) %>%
mutate(x = x1 * 20) %>%
rename("Estação" = x0) %>%
mutate(Estação = ifelse(Estação == "3", "Verão", Estação)) %>%
filter(.,Estação == "Verão") %>%
select(y, x, Estação)
# Bind
DF <- rbind(Summer, Winter)
# Plot
Plot <- DF %>%
ggplot(., aes(x = x, y = y, fill = Estação)) +
geom_jitter() +
geom_point(shape=21, alpha = 0.5, size=0.05) +
geom_smooth(method = "gam", formula = y ~ s(x, bs = "cs", k = 10), lwd = 1.6)
Plot
如何手动控制这 2 条样条线的颜色?
我希望它们每个都有不同的颜色,并且比几何点的颜色更暗。
解决方案
推荐阅读
- javascript - 如何更改 index.html 中正文的背景颜色?
- javascript - Leafletjs - 模拟/触发点击“mymap”
- asp.net-mvc-4 - 如何从 Kendo.Grid 的 ClientTemplate 内部向 JavaScript 函数发送参数?
- python - 如何重新排序字典的键?
- graph - 使用树函数在 gremlin 中返回边缘属性
- python - 将数据分成 4 个季节?
- android - 在 Google Play 中拆分后是否可以重新使用通用 apk?
- lora - LoRaWAN:即使我的产品没有通过LoRa联盟认证,是否允许写我的产品兼容LoRaWAN?
- javascript - AWS S3 泄漏连接
- pandoc - 如何在 Pandoc 的投影仪列中设置垂直对齐?