Tho*_*del 2 graphics r ggplot2
我正在尝试在同一图表中为不同级别的组var定制多个黄土图的外观.我查看了这篇文章,但无法使其发挥作用:
ggplot(iris, aes(x=Sepal.Length, y=Petal.Length, color=Species, linetype=Species)) +
stat_smooth(method = "loess")
Run Code Online (Sandbox Code Playgroud)
我想改变每个乐队和乐队的颜色.
您可以使用例如scale_color_manual
比例指定外观.在下面的例子中我也用override.aes
内guides
得到一个不错的传说,以及:
ggplot(iris, aes(x=Sepal.Length, y=Petal.Length, color=Species, linetype=Species)) +
stat_smooth(aes(fill=Species), method = "loess", size=1) +
scale_color_manual(values = c("green","blue","red")) +
scale_fill_manual(values = c("green","blue","red")) +
scale_linetype_manual(values = c("dashed","dotted","solid")) +
theme_bw() +
guides(fill=guide_legend(override.aes = list(fill="white",size=1.2)))
Run Code Online (Sandbox Code Playgroud)
这给了:
手动秤的其他替代品是hue
和brewer
秤.
归档时间: |
|
查看次数: |
2140 次 |
最近记录: |