Skip to content
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

Ordering of columns in FacetChart #3481

Open
liquidcarbon opened this issue Jul 16, 2024 · 2 comments
Open

Ordering of columns in FacetChart #3481

liquidcarbon opened this issue Jul 16, 2024 · 2 comments
Labels

Comments

@liquidcarbon
Copy link

liquidcarbon commented Jul 16, 2024

What happened?

I've been trying to lay out a chart with rows and columns where some of the values are missing, and ran into the problem of sort argument to alt.Column not working as expected.

without sorting

df = pd.DataFrame({
    'row': [1,1,1,2,2],
    'column': list('ABCAB'),
    'x': [1,2,3,4,5],
    'y': [1,2,3,4,5],
})

alt.Chart(df).mark_circle().encode(
    x='x',
    y='y',
    row='row',
    column=alt.Column('column')
).properties(width=120, height=80)

image

with sorting - incorrect order

alt.Chart(df).mark_circle().encode(
    x='x',
    y='y',
    row='row',
    column=alt.Column('column', sort=list('ABC'))
).properties(width=120, height=80)

image

Why would the bottom row shift? Is it a bug?

What would you like to happen instead?

proper sorting

Which version of Altair are you using?

5.3.0

@joelostblom
Copy link
Contributor

This looks like it could be due to the underlying Vega-Lite issue, probably this one vega/vega-lite#8675. Feel free to add your example there if you think it is the same issue or comment here if it isn't and we can troubleshoot further here.

@liquidcarbon
Copy link
Author

Thanks for your response.
One common theme between the calendar example in vega/vega-lite#8675, this toy example here, and the real thing I was trying to do:

Within the row with missing columns, the remaining values are pushed to the right. Very odd!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants