olgabot / prettyplotlib

Painlessly create beautiful matplotlib plots.
olgabot.github.io/prettyplotlib
MIT License
1.69k stars 148 forks source link

Scatterplot - axes.color_cycle is deprecated and replaced with axes.prop_cycle #92

Open glennzw opened 8 years ago

glennzw commented 8 years ago

When running the default scatter plot the following error is generated:

/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))
Traceback (most recent call last):
  File "scatter.py", line 13, in <module>
    ppl.scatter(ax, x, y, label=str(i))
  File "/usr/local/lib/python2.7/dist-packages/prettyplotlib/colors.py", line 35, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/prettyplotlib/_scatter.py", line 24, in scatter
    color_cycle = ax._get_lines.color_cycle
AttributeError: '_process_plot_var_args' object has no attribute 'color_cycle'

The code to recreate:

import prettyplotlib as ppl
import numpy as np

fig, ax = ppl.subplots()

# Set the random seed for consistency
np.random.seed(12)

# Show the whole color range
for i in range(8):
    x = np.random.normal(loc=i, size=1000)
    y = np.random.normal(loc=i, size=1000)
    ppl.scatter(ax, x, y, label=str(i))

ppl.legend()

ax.set_title('prettyplotlib `scatter` example\nshowing default color cycle and scatter params')
fig.savefig('scatter_prettyplotlib_default.png')

Tried modifying _scatter.py with s/ax._get_lines.color_cycle/ax._get_lines.prop_cycler/ (the closest named method I could see in the _ax._getlines object) but this didn't help. Before I dig deeper maybe you have some better ideas.

olgabot commented 8 years ago

Thank you for your bug report! If you have a pull request, I will accept it. However, I am no longer maintaining this package.