-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.facet does not accept facet=alt.Facet('x', columns=2) as an input #2563
Comments
Thanks for reporting this issue! Related SO question here for reference with some discussion in the comments |
This is now a bit more confusing because the new improved error message suggests that import altair as alt
from vega_datasets import data
source = data.barley.url
alt.Chart(source).mark_point().encode(
alt.X('median(yield):Q').scale(zero=False),
y='variety:O',
color='year:N'
).properties(
width=200,
height=100,
).facet(
alt.Facet('site:O', columns=2),
) Error message contradicting itself since
|
This isn't a bug, the issue was how many import polars as pl
import altair as alt
df = pl.DataFrame({"x": [1, 2, 3], "y": [1, 2, 3], "z": [1, 2, 3]})
chart = alt.Chart(df).mark_circle().encode(x="x", y="y") Errorchart.facet(facet=alt.Facet('z', columns=2)) Traceback
SchemaValidationError: `Facet` has no parameter named 'columns'
Existing parameter names are:
shorthand bin field timeUnit
aggregate bounds header title
align center sort type
bandPosition columns spacing
See the help for `Facet` to read the full description of these parameters Solutionchart.facet("z", columns=2) |
The issue is that when you do something like
But then proceeds to list
It's not a huge deal, but somewhat confusing and does not point users in the right direction ( |
@joelostblom I do see the error message as being an issue, maybe something to look into as part of #3752? Its tricky because import altair as alt
alt.Chart().facet(alt.Facet('z', columns=2))
# ^^^^^ Or: import altair as alt
alt.Chart().facet(alt.Facet('z', columns=2))
# ^^^^^ |
That sounds like a good idea! |
.facet accepts alt.Facet('x') as a input, but if you add columns as a parameter to alt.Facet it returns a 'data' is a required property error. I think this happens because .facet accepts columns as an argument as well.
Example:
alt.Chart(df).mark_circle().encode(x='x', y='y').facet(facet=alt.Facet('z', columns=2)
If this is not a bug, maybe the documentation for alt.Facet should indicate the expected use of the columns argument (or other arguments that may not work when used in the same manner)
The text was updated successfully, but these errors were encountered: