Variable plotting spaces I: continuous variables
By default every facet of a plot has the same axes. If the data ranges vary wildly between facets, it can be clearer if each facet has its own scale. This is achieved with the scales
argument to facet_grid()
.
"fixed"
(default): axes are shared between facets.free
: each facet has its own axes.free_x
: each facet has its own x-axis, but the y-axis is shared.free_y
: each facet has its own y-axis, but the x-axis is shared.
When faceting by columns, "free_y"
has no effect, but we can adjust the x-axis. In contrast, when faceting by rows, "free_x"
has no effect, but we can adjust the y-axis.
Cet exercice fait partie du cours
Intermediate Data Visualization with ggplot2
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
# Facet columns by cyl
___