0

Conceptually I thought a point would be dimensionless but I saw in the documentation that geom_point actually takes the aesthetic fill. However it doesn't seem to work for me:

ggplot(data = mtcars) + geom_point(aes(mpg, disp, fill = carb))

enter image description here

The aesthetics seems to be ignored, by I would expect a warning similarly to geom_line:

ggplot(data = mtcars) + geom_line(aes(mpg, disp, fill = carb))

Warning: Ignoring unknown aesthetics: fill

Dambo
  • 3,318
  • 5
  • 30
  • 79
  • @MauritsEvers thanks. Should I delete? – Dambo Feb 27 '18 at 02:39
  • [Best to not delete](https://meta.stackoverflow.com/questions/265736/should-i-delete-my-question-if-it-is-marked-as-a-duplicate); your question will be flagged and closed as a dupe within the next few hours, but will still help others here on SO with similar problems by acting as a sign post. – Maurits Evers Feb 27 '18 at 02:50

1 Answers1

2

If you set pch to a value that can take both color and fill it will work.

ggplot(mtcars, aes(x = wt, y = mpg)) + geom_point(size = 3, pch = 21, fill = "grey", color = "darkred")

enter image description here

babylinguist
  • 392
  • 1
  • 13