-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
When the data has so many rows that vegafusion is required for Altair to produce a plot — I believe the max before vegafusion is necessary is 5000 — a custom sort order for facet columns is ignored. MRE:
import altair as alt
import numpy as np
import polars as pl
import vegafusion
from IPython.display import display
print(
{
"altair": alt.__version__,
"polars": pl.__version__,
"vegafusion": vegafusion.__version__,
}
)
N = 5001
df = pl.DataFrame(
{
"person": np.random.choice(["Alice", "Bob"], N),
"x": np.random.rand(N),
"y": np.random.rand(N),
}
)
with alt.data_transformers.enable("vegafusion"):
chart = (
alt.Chart(df)
.mark_point()
.encode(alt.X("x"), alt.Y("y"))
.facet(column=alt.Column("person", sort=["Bob", "Alice"]))
)
_ = display(chart)Version info: {'altair': '5.5.0', 'polars': '1.35.1', 'vegafusion': '2.0.3'}
Chart (with Alice before Bob, which is incorrect):
When you decrease N to 5000 (but keep vegafusion enabled nonetheless), you get the expected behavior:

Metadata
Metadata
Assignees
Labels
No labels