question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Width, bandSize and margin issues

See original GitHub issue

default-bar-too-skinny bar-chart-margins-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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ellisonbgcommented, Oct 17, 2017

Should we close this then?

0reactions
jakevdpcommented, Mar 27, 2018

fixed in v2

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm getting a margin size error message (saying too big)
When this happens, the column width doesn't adjust automatically to the margin width but stays fixed at a certain amount.
Read more >
Some issues about relation between width/height and margin ...
If margin/padding/border were part of the width/height, there would be no such problem. I think that except width and height, ...
Read more >
FOLDS & DIMENSIONS
Finished Job Size ... 8.5” x 14” Fold in Halves. (8 panel - double fold). FOLDS & DIMENSIONS. Fold marks for finished job...
Read more >
CSS Box Model Module Level 3 - W3C
This specification describes the margin and padding properties, ... edge surrounds the rectangle given by the width and height of the box, ...
Read more >
what CSS could cause a page margin to break on bottom ...
html has position: fixed and is the same width and height of the browser. Therefore, when you use margins on the body the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found