Skip to content

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

@glennzw

Description

@glennzw

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.get_lines object) but this didn't help. Before I dig deeper maybe you have some better ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions