GGPLOT Color won't work [closed]

2019-09-01 11:05发布

问题:

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

回答1:

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.



标签: r ggplot2