-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH/VIS: Dataframe bar plot can now handle align keyword properly #6691
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
Conversation
self.assertEqual(ax.xaxis.get_ticklocs()[0], | ||
ax.patches[0].get_x() + ax.patches[0].get_width()) | ||
|
||
ax = df.plot(kind='bar', width=0.9, grid=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to remove this instead of replacing with
axes = self._check_bar_alignment(df, kind='bar', width=.9, stacked=False)
?
EDIT: Nevermind, it's further down. Github tricked me.
Thanks for this. We may want a little warning in the release notes that this will change the look of the default output. I'm onto sure how guarantee plots being identical from one version to another. You have a few magic numbers in the I had a couple of notes inline, but overall this looks good. If you look at those and rebase I'll get it merged. Thanks. |
Thanks for your confirmation. I added decorators / warning description in what's new txt, and rebased. Fixed numbers in
|
- `position`: Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1(right/top-end). Default is 0.5 (center). (:issue:`6604`) | ||
|
||
|
||
.. warning:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be here, instead in the plotting.rst (if where you show how to work with this option, if necessary)
OK. I have understood to write a warning about backward-compatibility in release note, but it should be in plotting.rst, or simply removed? I think usage is not necessary because the I'll correct my typo once confirmed where the description should be (or removed). |
ok so move both the release note and the v0.14.0 note to the API section - change from an actual warning block to just text in the note (no need for a separate warning block) |
Sure. Descriptions are under API Changes section, and corrected typo and warning block. |
ok by me... @TomAugspurger if ok, then go ahead and merge |
ENH/VIS: Dataframe bar plot can now handle align keyword properly
Looks good. Thanks |
Closes #4525.
I modified the
BarPlot
internal alignment to meet line coordinates. Previously,BarPlot
doesn't passalign
keyword to matplotlib (thus matplotlib usesalign='edge'
), but it adjusts bar locations to looks likealign='center'
.Now
BarPlot
passalign=center
to matplotlib by default and ticks are being locates on integer value starts from 0 (0.0, 1.0 ...). Drawing bar and line on the same axes looks like below.Output using current master:

Output after fix
