-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix plots showing multiple sets of axis labels if index is a timeseries. #8764
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
6b057ef
to
7e5e6b2
Compare
can you post the updated plots that result? |
for ax in axes[0:-1].ravel(): | ||
self._check_visible(ax.get_xticklabels(), visible=False) | ||
#Bottom row should be visible | ||
for ax in axes[-1].ravel(): |
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.
put a blank line in between these (each sub-block)
cc @michaelaye you raised this issue (a while ago!) can you have a look - see if this is the expectation |
This is another issue, but it seems as if the font size only affects the x axis.. (Confirmed it also happens on master). |
@dstephens99 ok, pls create a separate issue for that (as fix will be independent). |
Here's the code that generated the plot. Made it a bit easier to see with a bigger font and sharing the yaxis as well. import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
fig, axes = plt.subplots(3, 3, sharex=True, sharey=True)
plt.subplots_adjust(left=0.05, right=0.95, hspace=0.1, wspace=0.1)
df = pd.DataFrame(np.random.randn(10, 9), index=pd.date_range(start='2014-07-01', freq='M', periods=10))
for i, ax in enumerate(axes.ravel()):
df[i].plot(ax=ax, fontsize=8) |
7e5e6b2
to
ba3a046
Compare
Checked out this branch. Looks good to me, thanks! |
I'll be able to check this out in a week or so.
|
@dstephens99 can you rebase |
@@ -3248,32 +3289,16 @@ def _subplots(naxes=None, sharex=False, sharey=False, squeeze=True, | |||
label.set_visible(False) | |||
try: | |||
import matplotlib.ticker as ticker | |||
ax.yaxis.set_minor_locator(ticker.AutoLocator()) | |||
ax.yaxis.set_minor_formatter(ticker.FormatStrFormatter('')) | |||
if isinstance(ax.xaxis.get_minor_locator(), ticker.NullLocator): |
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.
I could be confused here, but should this be checking if isinstance(ax.yaxis...)
(i.e. yaxis, not x?
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.
Yes, your right. Will change this.
Just the one note about x vs y. Then lets merge it. May need one more rebase, but I promise I won't let it sit around waiting to be merged this time! |
@TomAugspurger ready to go? can rebase on the merge if needed |
ba3a046
to
40aec1b
Compare
Yeah, I think so. I'll do one more once-over and then rebase on merge. |
Merged via 7d13fdd |
Thanks @dstephens99! |
Fixes #3964