Spacing error in bar graphs?

21 views
Skip to first unread message

Richard Stanton

unread,
Oct 13, 2012, 12:36:31 AM10/13/12
to pyd...@googlegroups.com
Unless they're deliberately off-center, it looks like the bars in bar charts are plotted a bit too far to the left relative to ticks, labels and grid lines (all of which seem to line up fine).

Here's an example that shows what I mean (you can see it in your browser, or else save to a PDF file and look at that):

df = DataFrame({'A' : [3] * 30, 'B' : range(30)}, index = range(30))
df.plot(kind='bar', stacked='True', grid=True)
draw()


Wouter Overmeire

unread,
Oct 15, 2012, 3:44:48 PM10/15/12
to pyd...@googlegroups.com


2012/10/13 Richard Stanton <sta...@haas.berkeley.edu>


--



Had a look into the code. For an unstacked plot the bars have a width of 0.5, in case of stacked=True width is set to 0.75.
For both cases the xticks are set at the exact same positions. Result is that grid is centered for an unstacked plot, but off-center in case of stacked bar plot. Easy to fix.


Reply all
Reply to author
Forward
0 new messages