Variable plotting spaces II: categorical variables
When you have a categorical variable with many levels which are not all present in each sub-group of another variable, it's usually desirable to drop the unused levels.
By default, each facet of a plot is the same size. This behavior can be changed with the spaces argument, which works in the same way as scales: "free_x" allows different sized facets on the x-axis, "free_y", allows different sized facets on the y-axis, "free" allows different sizes in both directions.
Deze oefening maakt deel uit van de cursus
Intermediate Data Visualization with ggplot2
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
ggplot(mtcars, aes(x = mpg, y = car, color = fam)) +
geom_point() +
# Facet rows by gear
___