Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Pandas rendering minor ticks in matplotlib sublots with shared axes #10657
Comments
williamsmj
commented
Jul 28, 2015
|
To add to this, the bug shown in the notebook linked above happens in
The bug does not happen with:
A pandas regression? |
TomAugspurger
added the
Visualization
label
Jul 28, 2015
|
Thanks. It probably is a maybe a regression on our end. We kind of take over the axes and use our own logic for determining what to draw. Your plot appears to work when you pass in |
williamsmj
commented
Jul 28, 2015
|
Yes, you're right. To be consistent with the Happy to attempt a first PR if someone can point me in the direction of the file(s) that might have introduced this regression! |
|
@sinhrks am I correct in thinking that this is buggy? In [25]: x = pd.DataFrame(list(zip(range(10), range(0, -10, -1))), columns=['a', 'b'])
In [26]: x.index = pd.date_range('2000-01-01', freq='Q', periods=10)
In [27]: fig, ax = plt.subplots(2, 1, sharex=True)
In [28]: x.plot(subplots=True, ax=ax)
Out[28]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x116b96630>,
<matplotlib.axes._subplots.AxesSubplot object at 0x117580198>], dtype=object)
In [29]: plt.savefig('nosavefig.png')
In [30]: fig, ax = plt.subplots(2, 1, sharex=True)
In [31]: x.plot(subplots=True, ax=ax, sharex=True)
/Users/tom.augspurger/Envs/py3/lib/python3.4/site-packages/pandas/tools/plotting.py:3218: UserWarning: When passing multiple axes, sharex and sharey are ignored.These settings must be specified when creating axes
"These settings must be specified when creating axes", UserWarning)
Out[31]:
array([<matplotlib.axes._subplots.AxesSubplot object at 0x117deb940>,
<matplotlib.axes._subplots.AxesSubplot object at 0x10c64f828>], dtype=object)
In [32]: plt.savefig('with_share.png')
I haven't looked at this section in a while. |
williamsmj
commented
Jul 28, 2015
|
I think it's 015fc62 that's the problem. Given the stated intentions of that commit, it's above my pay grade to determine whether this new behaviour is a feature or a bug! |
|
@TomAugspurger Yes, major/minor ticklabel should be displayed when |
TomAugspurger
added the
Regression
label
Jul 30, 2015
TomAugspurger
modified the milestone: 0.17.0, Next Major Release
Jul 30, 2015
TomAugspurger
added Difficulty Intermediate Effort Low
labels
Jul 30, 2015
|
cc @janschulz Do you remember in pydata#9740 how the interaction of |
|
@TomAugspurger sorry, no idea whats going wrong here. I only tested (optimized for...) a gridspec without sharex, seems that I overlooked this case :-( |


williamsmj commentedJul 22, 2015
When the plot method of a dataframe is passed an
axkeyword to render to a matplotlib subplot, the minor ticks and their labels are rendered regardless of whethersharex|y=True. The major ticks/labels are correctly removed.Here's a short notebook that reproduces the issue. Note that the minor ticks are included in the upper axes of the final figure.
I am 90% certain this is a regression, but I wasn't able to pin down which version of pandas or matplotlib prompted this bug. Nor was I able to figure out whether this was due to pandas or matplotlib.