Skip to content
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

Factor plot does not completely obey axes specification #488

Closed
fonnesbeck opened this issue Mar 25, 2015 · 3 comments
Closed

Factor plot does not completely obey axes specification #488

fonnesbeck opened this issue Mar 25, 2015 · 3 comments

Comments

@fonnesbeck
Copy link
Contributor

I'm trying to generate a factorplot on a specific set of axes, which I generate using matplotlib's subplots function.

import seaborn as sb
sb.set_context("talk", font_scale=0.8)
sb.set_style("white")

f, axes = plt.subplots(figsize=(14,8))
g = sb.factorplot("Age", "S", "Confirmation", S_age_june, kind="box",
                   palette="PRGn", aspect=1.25, linewidth=0.3, fliersize=0, ax=axes)
g.despine(offset=10, trim=True)
g.set_axis_labels("Age Group", "Susceptibles");

However, running this code in IPython generates an extra, blank, partially-formatted set of axes below the plot of the data (which has not received the formatting specified to g):

Running 0.6.dev on Python 3.4 (Homebrew).

@fonnesbeck
Copy link
Contributor Author

Solved my particular problem using size and aspect, but nevertheless I would expect that once ax is specified for g that all subsequent methods applied to g would operate on those axes.

@mwaskom
Copy link
Owner

mwaskom commented Mar 25, 2015

Indeed, we can say more strongly: factorplot does not at all obey axes specification. See here for an explanation.

If you just want to set up the axes that way so you can have a figure with a specific size, you can pass size=8, aspect=14 / 8. to factorplot. Note also that since you're on 0.6 dev you can do hue grouping in sns.boxplot, which can plot onto an existing Axes.

@fonnesbeck
Copy link
Contributor Author

OK, I'm satisfied. Thanks.

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

No branches or pull requests

2 participants