Skip to content

Pass rc.cmap and rc.cycle arguments through respective constructor functions #169

Description

@zxdawn

Description

Since cycle supports cmaps, the input of cmap name in the configuration should be supported.

Steps to reproduce

import proplot as plot
import numpy as np

fig, axs = plot.subplots()
state = np.random.RandomState(51423)
data = (20 * state.rand(10, 21) - 10).cumsum(axis=0)

plot.rc.update({'cycle': 'plum', 'lines.linewidth': '5'})
lines = axs.plot(data[:, :5])

Expected behavior:
Like:

plot.rc.update({'lines.linewidth': '5'})
lines = axs.plot(data[:, :5], cycle='plum')

cmap

Actual behavior: [What actually happened]

Traceback (most recent call last):
  File "/home/xin/Desktop/test.py", line 11, in <module>
    plot.rc.update({'cycle': 'plum', 'lines.linewidth': '5'})
  File "/home/xin/Documents/Github/proplot/proplot/config.py", line 906, in update
    self.__setitem__(prefix + key, value)
  File "/home/xin/Documents/Github/proplot/proplot/config.py", line 410, in __setitem__
    kw_quick, kw_added, kw_params = self._get_param_dicts(key, value)
  File "/home/xin/Documents/Github/proplot/proplot/config.py", line 490, in _get_param_dicts
    colors = _get_cycle_colors(value)
  File "/home/xin/Documents/Github/proplot/proplot/config.py", line 1020, in _get_cycle_colors
    + ', '.join(map(repr, cycles)) + '.'
ValueError: Invalid cycle name 'plum'. Options are: '538', 'accent', 'classic', 'colorblind', 'colorblind10', 'dark2', 'default', 'flatui', 'ggplot', 'paired', 'pastel1', 'pastel2', 'qual1', 'qual2', 'set1', 'set2', 'set3', 'tab10', 'tab20', 'tab20b', 'tab20c'.

Proplot version

master branch

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions