我已經搜索了兩天的答案,但仍然找不到如何做到這一點。
uj5u.com熱心網友回復:
如果你想得到一個圖例,你必須在美學上進行映射,例如,你可以在shape
aes 上進行映射,以獲得你的點的圖例:
library("ggplot2")
ggplot(MyDF, aes(x = Year, y = TheData))
geom_point(aes(y = TheData, shape = "TheData"), size = 2.5)
geom_line(aes(x = Year, y = Model, color = "Model"))
geom_ribbon(aes(ymin = Lower, ymax = Upper, x = Year,
fill = "Confidence Interval"), alpha = 0.15)
scale_colour_manual(
name = "", values = c("Confidence Interval" = "transparent",
"Model" = "black"))
scale_fill_manual(
name = "", values = c("Confidence Interval" = "grey12",
"Model" = "transparent"))
theme(legend.position = "bottom")
labs(shape = "")
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/485862.html
上一篇:自動繪圖功能和分解