Skip to content

BUG: mpl_style 'default' gives AttributeError: Unknown property color_cycle with latest matplotlib #11727

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
jorisvandenbossche opened this issue Nov 30, 2015 · 5 comments · May be fixed by jvns/neural-nets-are-weird#6
Labels
Milestone

Comments

@jorisvandenbossche
Copy link
Member

http://stackoverflow.com/questions/33995707/attributeerror-unknown-property-color-cycle

In [1]: matplotlib.__version__
Out[1]: '1.5.0'

In [2]: df = pd.DataFrame(np.random.randn(5,5))

In [4]: df.plot()
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x7bc5c50>

In [5]: pd.set_option('display.mpl_style', 'default')

In [6]: df.plot()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
....

AttributeError: Unknown property color_cycle

In [7]: pd.__version__
Out[7]: '0.17.1'
@TomAugspurger
Copy link
Contributor

I'm not sure exactly what's happening here based on a quick glance. I do check for mpl1.5 and adjust our stylesheet.

@jorisvandenbossche
Copy link
Member Author

I jut see that some lines below, there is a harcoded plt.rcParams.get('axes.color_cycle') : https://github.com/pydata/pandas/blob/0c43fcc5d128397becc0b67557311b4e8ee53100/pandas/tools/plotting.py#L166

@TomAugspurger
Copy link
Contributor

Ugh good find. That should be conditional on the matplotlib version. Should we just retroactively declare that stylesheet deprecated 😀?

@jorisvandenbossche
Copy link
Member Author

+1!

@brian-pantano
Copy link

The correct fix is to change

mpl_stylesheet['axes.prop_cycle'] = cycler.cycler('color_cycle', colors)

to

mpl_stylesheet['axes.prop_cycle'] = cycler.cycler('color', colors)

There's no prop_cycle called 'color_cycle'. I believe the prop_cycle you're looking for is 'color'. http://matplotlib.org/examples/color/color_cycle_demo.html.

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 a pull request may close this issue.

4 participants