-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
X axis weirdness with DataFrame.plot(kind='bar') #11465
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
Labels
Comments
Thanks for the report, might be related to #2980? PR is appreciated! |
I think both of these issues are related to #7612 |
Closing as duplicate of #7612 |
re-opening as not fixed by #26185 |
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
May 26, 2019
Generate the tick position in BarPlot using convert tools from matlab. Add test for issue pandas-dev#26186 Add test for issue pandas-dev#11465
I am also running into the same problem. Only when kind='bar'. |
I can confirm, running into the same issue. Any ideas on how to fix this? |
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Oct 1, 2019
6 tasks
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Nov 19, 2019
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Feb 12, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Feb 16, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Feb 16, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Mar 14, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Jun 13, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Jun 17, 2020
nrebena
added a commit
to nrebena/pandas
that referenced
this issue
Sep 12, 2020
charlesdong1991
pushed a commit
that referenced
this issue
Nov 21, 2020
* TST: Test for issues #26186 and #11465 * BUG: Generate the tick position in BarPlot using convert tools from matlab. Generate the tick position in BarPlot using convert tools from matlab. * TST: Modify tests/plotting/test_frame.test_bar_categorical Ticklocs are now float also for categorical bar data (as they are position on the axis). The test is changed to compare to a array of np.float. * TST: Fix test for windows OS * TST: Add test for plotting MultiIndex bar plot A fix to issue #26186 revealed no tests existed about plotting a bar plot for a MultiIndex, but a section of the user guide visualization did. This section of the user guide is now in the test suite. * BUG: Special case for MultiIndex bar plot * DOC: Add whatsnew entry for PR #28733 * CLN: Clean up in code and doc * CLN: Clean up test_bar_numeric * DOC Move to whatsnew v1.1 * FIX: Make tick dtype int for backwards compatibility * DOC: Improve whatsnew message * ENH: Add UserWarning when plotting bar plot with MultiIndex * CLN: Remove duplicate code line * TST: Capture UserWarning for Bar plot with MultiIndex * TST: Improve test explanation * ENH: Raise UserWarning only if redrawing on existing axis with data * DOC: Move to whatsnew v1.2.9 Co-authored-by: Marco Gorelli <[email protected]>
PR that fixed this, #28733 has been reverted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I encountered this issue when plotting some vertical axes spans on the same axes as a bar plot. Some example code is below to reproduce the issue. When using either scatter or line plots, the spans show up where they are supposed to, but the bar plot is off.
Digging a little deeper, I found that the plot call is setting the xticks to a zero-indexed array with a step size of one while setting the tick labels to the correct values.
If you specify the x ticks in the call to the bar plot, the spans are plotted at the correct position, but the bars are plotted from the same 0-indexed, singly incrementing array.
axes 0
[(5.0, u''), (10.0, u''), (15.0, u''), (20.0, u''), (25.0, u''), (30.0, u''), (35.0, u'')]
axes 1
[(0, u'5'), (1, u'7'), (2, u'9'), (3, u'11'), (4, u'13'), (5, u'15'), (6, u'17'), (7, u'19'), (8, u'21'), (9, u'23'), (10, u'25'), (11, u'27'), (12, u'29'), (13, u'31'), (14, u'33')]
axes 2
[(5, u'5'), (7, u'7'), (9, u'9'), (11, u'11'), (13, u'13'), (15, u'15'), (17, u'17'), (19, u'19'), (21, u'21'), (23, u'23'), (25, u'25'), (27, u'27'), (29, u'29'), (31, u'31'), (33, u'33')]
The text was updated successfully, but these errors were encountered: