Get startedGet started for free

All about aesthetics: color vs. fill

Typically, the color aesthetic changes the outline of a geom and the fill aesthetic changes the inside. geom_point() is an exception: you use color (not fill) for the point color. However, some shapes have special behavior.

The default geom_point() uses shape = 19: a solid circle. An alternative is shape = 21: a circle that allow you to use both fill for the inside and color for the outline. This is lets you to map two aesthetics to each point.

All shape values are described on the points() (docs) help page.

fcyl and fam are the cyl and am columns converted to factors, respectively.

This exercise is part of the course

Introduction to Data Visualization with ggplot2

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Map fcyl to fill
ggplot(mtcars, aes(wt, mpg, color = fcyl)) +
  geom_point(shape = 1, size = 4)
Edit and Run Code