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

Closed
jorisvandenbossche opened this Issue Nov 30, 2015 · 5 comments

Comments

Projects
None yet
4 participants
@jorisvandenbossche
Member

jorisvandenbossche commented Nov 30, 2015

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

This comment has been minimized.

Show comment
Hide comment
@TomAugspurger

TomAugspurger Nov 30, 2015

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.

Contributor

TomAugspurger commented Nov 30, 2015

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

This comment has been minimized.

Show comment
Hide comment
@jorisvandenbossche

jorisvandenbossche Nov 30, 2015

Member

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

Member

jorisvandenbossche commented Nov 30, 2015

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

This comment has been minimized.

Show comment
Hide comment
@TomAugspurger

TomAugspurger Nov 30, 2015

Contributor

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

Contributor

TomAugspurger commented Nov 30, 2015

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

@jorisvandenbossche

This comment has been minimized.

Show comment
Hide comment
Member

jorisvandenbossche commented Nov 30, 2015

+1!

hassanfa referenced this issue in pythonkurs/2015-11-30-swc_data Dec 2, 2015

DEKHTIARJonathan added a commit to JD-accounts/neural-nets-are-weird that referenced this issue Jan 2, 2016

Proxy Support Added with global var.
Panda Issue fixed : pandas-dev/pandas#11727 && pandas-dev/pandas#11783

Notebook Checked & Working Perfectly. Executed from started in a "Run All" way.
@brian-pantano

This comment has been minimized.

Show comment
Hide comment
@brian-pantano

brian-pantano Feb 2, 2016

Contributor

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.

Contributor

brian-pantano commented Feb 2, 2016

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