All about aesthetics: color, shape and size
In the video you saw 9 visible aesthetics. Let's apply them to a categorical variable — the cylinders in mtcars
, cyl
.
These are the aesthetics you can consider within aes()
in this chapter: x
, y
, color
, fill
, size
, alpha
, labels
and shape
.
One common convention is that you don't name the x
and y
arguments to aes()
, since they almost always come first, but you do name other arguments.
In the following exercise the fcyl
column is categorical. It is cyl
transformed into a factor
.
This exercise is part of the course
Introduction to Data Visualization with ggplot2
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Map x to mpg and y to fcyl
ggplot(mtcars, aes(___, ___)) +
geom_point()