GGPLOT Color won't work [closed]

2019-09-01 11:07发布

It must be very simple. I just want to set the color for a scatter plot.

 library(ggplot2)
 df3=data.frame(cbind("A", 5, 3))
 ggplot(data = df3) + geom_point(aes(x = X2, y = X3, colour = "black"))

Why is it pink and not black? I've tried with hex code as well.

image

标签: r ggplot2
1条回答
在下西门庆
2楼-- · 2019-09-01 11:44
library(ggplot2)
df3=data.frame(cbind("A", 5, 3))
ggplot(data = df3) + geom_point(aes(x = X2, y = X3), colour = "black")

That's a solution to your problem. Colour should be a parameter of geom_point() function and not aes.

查看更多
登录 后发表回答