Width, bandSize and margin issues
See original GitHub issue
Discovered Altair today, and very pleased, but stuck on these charts. For some reason, I get a super skinny chart by default when trying to sum the total funding by grant / loan. (Another chart from a simple series-turned data frame didn’t present the width issue; for that I got a regular-looking chart.)
So, I borrowed this format from here: http://localhost:8888/notebooks/AltairTutorial/auto_examples/stacked_bar_weather.ipynb (Sorry, can’t find a public URL for that. It’s one of the files generated by running tutorial() ) UPDATE: found sample format here–though it doesn’t display the sample graphic on GitHub: https://github.com/pybokeh/jupyter_notebooks/blob/8c9669d953bde5efda23ac1fcf61a1ca01d1457d/altair/AltairTutorial/auto_examples/stacked_bar_weather.ipynb
I spent a lot of time on the issue queue, and discovered barSize, and bandSize. barSize actually did impact the width, as you can see above. Unfortunately, the first and last bar are falling on top of the right and left edge. (As far as I can tell, bandSize doesn’t do anything for my chart).
Suggestions welcome. What can I do to get some padding to the left and right of the first and last bar, respectively? Why was I getting super-skinny bars by default? Is bandSize doing anything for me? would tickPadding help? If so, where does that go? Is there a way to get Grants on the bottom and Loans on the top?
chart = Chart(kyf2).mark_bar( barSize=25).encode(
color=Color('grant_loan:N',
legend=Legend(
title='Legend',
),
scale=Scale(
domain=['Loan', 'Grant'],
range=['salmon', '#1f77b4'],
)
),
x=X('Year:T',
axis=Axis(
title='Year',
),
timeUnit='year',
),
y='sum(Funding):Q',
).configure_cell(
height=200,
width=330
).configure_scale(bandSize=500)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
Should we close this then?
fixed in v2