-
Notifications
You must be signed in to change notification settings - Fork 766
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
Grouped bar charts with grid #230
Comments
You can set the from altair import *
population = load_dataset('population')
Chart(population).mark_bar().encode(
X('sex:N', axis=False, scale=Scale(bandSize=6)),
Y('sum(people):Q', axis=Axis(grid=True)),
Color('sex:N', scale=Scale(range=["#FF9800", "#03A9F4"])),
Column('age:O', axis=Axis(orient='bottom'), scale=Scale(padding=0))
).configure_facet_cell(
strokeWidth=0, height=250
) The result looks a bit different than yours because I didn't apply any transform. |
Thanks that helps. Now what if I want the bars to be grouped, not only sequentially, but also visually? In other words, how do I get the padding between groups back? ;-) Sorry, that's not very useful, but in many vizualizations I really do want the categories be spatially separated for ease of interpretation, but still have the gridlines to be able to compare bar height across categories... |
Apparently this is a "feature" of vega-lite, and the desired appearance can only be achieved through editing of the resulting vega spec. https://groups.google.com/d/msg/vega-js/P7a_k0sEVNA/pqJ8hVaAAQAJ |
There is now a feature request for this in vega/vega-lite#1636 |
Thanks! |
Closing as vega-lite-related. |
scale is not available in Column in latest version of altair. How to achieve this in latest version? |
Use the |
I'm trying to produce a grouped bar chart, with horizontal grid lines turned on. Starting from the grouped bar chart example in the altair tutorials, I turned on the grid on the Y axis, as follows:
However, this causes the grid lines to be interrupted between groups. How can we make the grid lines go across group columns?
Thanks,
--nico
The text was updated successfully, but these errors were encountered: