Open
Description
It would be nice if we could add a page about the new offset encoding that contained common examples. In addition to the offset barplot in the VegaLite docs, I think these examples would be nice:
import altair as alt
from vega_datasets import data
source = data.barley.url
alt.Chart(source).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset='year:N',
color='year:N',
)
alt.Chart(source).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset=alt.XOffset('offset:Q', scale=alt.Scale(domain=(0, 3)))
).transform_calculate(
offset='random()'
)
alt.Chart(source, width=alt.Step(40)).mark_point().encode(
x='site:O',
y='yield:Q',
xOffset=alt.XOffset('offset:Q', scale=alt.Scale(domain=(0, 10))),
color='year:N'
).transform_calculate(
offset="datum.year == 1932 ? 5 + random() : 0 + random()"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment