AlgebraOfGraphics.jl
supports layouts with plots in multiple rows and columns, also known as faceting. These are specified using the keywords arguments layout
, row
and col
inside mapping
. If you use layout
, AlgebraOfGraphics.jl
will try to use the best combinations of rows and columns to layout the visualization:
plt = data(df) *
mapping(
:name,
:grade;
layout=:year) *
visual(BarPlot)
draw(plt)
However, you can override that by using either row
or col
for multiple rows or multiple columns layouts, respectively. Here’s an example with row
:
plt = data(df) *
mapping(:name, :grade; row=:year) *
visual(BarPlot)
draw(plt)
And, finally, an example with col
:
plt = data(df) *
mapping(
:name,
:grade;
col=:year) *
visual(BarPlot)
draw(plt)
NOTE: You use both
row
andcol
one for each categorical variable.