I need to create a faceted chart in altair. I am using the example given in this link (https://altair-viz.github.io/user_guide/compound_charts.html) which places charts horizontally. The code is
import altair as alt
from vega_datasets import data
iris = data.iris.url
alt.Chart(iris).mark_point().encode(
x='petalLength:Q',
y='petalWidth:Q',
color='species:N',
column='species:N'
).properties(
width=180,
height=180
)
My question is if it is possible to get the same charts but vertically. The output required is similar to the one answered by @jakevdp for this question (Altair facet charts save individual image) but without the need to create separate charts. Screenshot -
Thanks
Yes, just change column to row.
import altair as alt
from vega_datasets import data
iris = data.iris.url
alt.Chart(iris).mark_point().encode(
x='petalLength:Q',
y='petalWidth:Q',
color='species:N',
row='species:N'
).properties(
width=180,
height=180
)