How to reverse the sort order of stacked bars
See original GitHub issueHere’s my draft chart.
alt.Chart(latino_chart_prepped, title="Latino share of U.S. population").mark_bar().encode(
alt.X('age:O', axis=alt.Axis(title="Age"), sort=alt.SortField(field="sort", op="sum", order="ascending")),
alt.Y('population:Q',
axis=alt.Axis(title='Percent of population'),
stack='normalize'
),
alt.Color('group:N', legend=None)
).properties(
width=600
)
How do I reverse the sort order so that the smaller blue bars are on the bottom of each stack in the chart?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Reversing the order of stacked bar chart - Tableau Community
Right click on Color Mark of Audit Failur and select Descending... Have tried replicating with Sample super store data source. Let me know...
Read more >Solved: Reverse order in Stacked Column Chart
Reverse order in Stacked Column Chart · 1. Create a proper order column if you don't have one. · 2. Change the sort...
Read more >Stacked Bar Chart columns are in reverse order
If you want the A series to be stacked at the top, you just need to re-arrange the order of the data in...
Read more >Change the plotting order of categories, values, or data series
Reverse the plotting order of categories or values in a chart · For categories, select the Categories in reverse order check box. ·...
Read more >Reverse stacked bar order - Stack Overflow
position_fill(reverse = TRUE) normalizes bars, use position_stack(reverse = TRUE) if you don't want to normalize bars. – mihagazvoda. Sep 10, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nope, I’m still working on getting things like that in the docs. It’s a long process.
Some examples would be useful… we also need an actual in-depth discussion of all the encodings that are available and what they are good for.
Add an
order
channel:You may need to use
sort='descending'
instead… without seeing your data, it’s difficult to guess.