Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

davidastephens
Copy link
Contributor

Fixes #3964

@davidastephens davidastephens force-pushed the issue3964 branch 2 times, most recently from 6b057ef to 7e5e6b2 Compare November 9, 2014 22:53
@jreback
Copy link
Contributor

jreback commented Nov 9, 2014

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():
Copy link
Contributor

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)

@jreback jreback added this to the 0.15.2 milestone Nov 9, 2014
@davidastephens
Copy link
Contributor Author

Here it is:

figure_1

@jreback
Copy link
Contributor

jreback commented Nov 9, 2014

cc @michaelaye you raised this issue (a while ago!)

can you have a look - see if this is the expectation

@TomAugspurger

@davidastephens
Copy link
Contributor Author

This is another issue, but it seems as if the font size only affects the x axis.. (Confirmed it also happens on master).

@jreback
Copy link
Contributor

jreback commented Nov 9, 2014

@dstephens99 ok, pls create a separate issue for that (as fix will be independent).

@davidastephens
Copy link
Contributor Author

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)

figure_2

@michaelaye
Copy link
Contributor

Checked out this branch. Looks good to me, thanks!

@TomAugspurger
Copy link
Contributor

I'll be able to check this out in a week or so.

On Nov 10, 2014, at 13:59, K.-Michael Aye [email protected] wrote:

Checked out this branch. Looks good to me, thanks!


Reply to this email directly or view it on GitHub.

@jreback
Copy link
Contributor

jreback commented Dec 4, 2014

@dstephens99 can you rebase

@TomAugspurger ?

@@ -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):
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@TomAugspurger
Copy link
Contributor

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!

@jreback
Copy link
Contributor

jreback commented Dec 6, 2014

@TomAugspurger ready to go?

can rebase on the merge if needed

@TomAugspurger
Copy link
Contributor

Yeah, I think so. I'll do one more once-over and then rebase on merge.

@TomAugspurger
Copy link
Contributor

Merged via 7d13fdd

@TomAugspurger
Copy link
Contributor

Thanks @dstephens99!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plotting using subplots
4 participants