Faceting (Trellis Plot / Small Multiples)

Trellis Bar Chart

using VegaLite, VegaDatasets

dataset("population") |>
@vlplot(
    :bar,
    transform=[
        {filter="datum.year==2000"},
        {calculate="datum.sex==2 ? 'Female' : 'Male'",as=:gender}
    ],
    row="gender:n",
    y={"sum(people)", axis={title="population"}},
    x="age:o",
    color={"gender:n", scale={range=["#EA98D2", "#659CCA"]}},
    width={step=17}
)

Trellis Stacked Bar Chart

using VegaLite, VegaDatasets

dataset("barley") |>
@vlplot(:bar, column="year:o", x="sum(yield)", y=:variety, color=:site)

Trellis Scatter Plot

using VegaLite, VegaDatasets

dataset("movies") |>
@vlplot(:point, columns=2, wrap="MPAA_Rating:o", x=:Worldwide_Gross, y=:US_DVD_Sales)