-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Series.plot() ignores label keyword #10119
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
Yep I noticed that last night. For people looking for a workaround, the index name is still used if it's set. s.name = 'stuff'
s.plot() |
Hmm, this is really an annoying regression. I use the following pattern rather commonly:
which now gives a legend with two times 'var', and which is also not that easily to fix with the workaround of above |
Yes extremely annoying :/ I'll rebase my PR fixing it today. |
👍 same problem with 0.16.1. |
Sorry for spamming a closed bug but I thought a couple of suggestions could be useful. @jorisvandenbossche, not very straightforward but you can do this: Or monkey patch Series.plot: copy this code into a module and import it at the beginning of yours: # Monkey patch to work around pandas 0.16.1 issue #10119.
# https://github.com/pydata/pandas/issues/10119
import pandas as pd
if pd.__version__ == '0.16.1':
_old_plot = pd.Series.plot
def _plot(self, *args, label=None, **kwargs):
return _old_plot(pd.Series(self, name=label), *args, **kwargs)
pd.Series.plot = _plot Or just patch your local pandas (but this won't help other people using your code). |
Small fix (note the label declaration)
And I can't get it working in ipytho notebook. |
@TomAugspurger @jorisvandenbossche In #9574 I had removed: |
|
I added tests in my PR so it should be tested now. |
Using pandas 0.16.1, tested in several environments:
This is a regression since 0.16.0. I think the problem is in this line in pandas.tools.plotting.MPLPlot._compute_plot_data():
label = self.kwds.pop('label', None)
It should read:
label = self.label
because the label has been popped before and stored in an attribute.
I want to make a pull request but it will take some time to install git, set up a development environment and get my fingers to relearn their way through it all so it will be a lot of opportunities to beat me.
The text was updated successfully, but these errors were encountered: