-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Cannot update boxplot via axes #4636
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
Comments
It seems that if you do
instead of just
that you then can update the figure via |
The solution suggested by @jorisvandenbossche does not appear to work, at least as of 0.13.0rc1-64-gceec8bf. I get the following:
|
So @fonnesbeck as a bad workaround, you could grab the In [150]: fig, ax = plt.subplots()
In [151]: ax = df.boxplot(ax=ax, grid=False)
In [152]: ax
Out[152]:
{'fliers': [<matplotlib.lines.Line2D at 0x10bde7850>,
<matplotlib.lines.Line2D at 0x10bdea910>,
<matplotlib.lines.Line2D at 0x10bdf9c90>,
<matplotlib.lines.Line2D at 0x10bdfdd50>],
'caps': [<matplotlib.lines.Line2D at 0x10bddedd0>,
<matplotlib.lines.Line2D at 0x10bdda0d0>,
<matplotlib.lines.Line2D at 0x10bdefa50>,
<matplotlib.lines.Line2D at 0x10bdf4610>],
'whiskers': [<matplotlib.lines.Line2D at 0x10bdde710>,
<matplotlib.lines.Line2D at 0x10bdc7190>,
<matplotlib.lines.Line2D at 0x10bdea9d0>,
<matplotlib.lines.Line2D at 0x10bdef4d0>],
'medians': [<matplotlib.lines.Line2D at 0x10bde7110>,
<matplotlib.lines.Line2D at 0x10bdf9410>],
'boxes': [<matplotlib.lines.Line2D at 0x10bdd7b10>,
<matplotlib.lines.Line2D at 0x10bdf4b50>]}
In [153]: real_ax = ax['fliers'][0].get_axes()
In [154]: real_ax.set_xlabel("Patient")
Out[154]: <matplotlib.text.Text at 0x10be51710> |
closing this ... as it works in all examples shown. if i have some time i'll see if i can find what commit fixes this. |
When I construct a boxplot with pandas, e.g. like this:
I cannnot change the plot anymore via
ax
, e.g.ax.set_ylim(0,20)
orax.set_ylabel("Something")
has no effect on the figure.Complete example: http://nbviewer.ipython.org/5868420/bug_pandas-boxplot-set-ylim.ipynb
I tested it on the dev version of pandas (and I know it worked previously, but cannot check which version exactly anymore).
The text was updated successfully, but these errors were encountered: