关于r:更改散点图和着色

change scatterplot points and coloring

本问题已经有最佳答案,请猛点这里访问。

我在下面用此代码生成了简单的散点图:

1
2
library(ggplot2)
ggplot(Orange, aes(x = age, y = circumference)) + geom_point()

enter


您还可以在数据集中获取另一个变量,并将其用作"颜色"(完全不直观,但是可行)。我喜欢这种方式如何自动创建图例。

1
ggplot(Orange, aes(x = age, y = circumference, color=Tree)) + geom_point()

enter