Skip to content

cannot set default drawstyle (to 'steps-post') #12582

Closed
@tsdlovell

Description

@tsdlovell

Bug report

Bug summary

Cannot set drawstyle default to 'steps-post' in 3.0.0

In 2.0.2 I could set the default drawstyle by settings rcParams['lines.linestyle']. In 3.0.0, it barfs.

Is there a different way to set this? I don't see any rcParams keys that reference drawstyle or look like they could be impacting drawstyle

Code for reproduction

Python 3.5.4 |Continuum Analytics, Inc.| (default, Aug 14 2017, 13:26:58)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import matplotlib

In [2]: matplotlib.__version__
Out[2]: '2.0.2'

In [3]: matplotlib.rcParams['lines.linestyle'] = 'steps-post'

In [4]: print(matplotlib.get_backend())
Qt5Agg

In 3.0.0, this happens

Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.0.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import matplotlib

In [2]: matplotlib.__version__
Out[2]: '3.0.0'

In [3]: matplotlib.rcParams['lines.linestyle'] = 'steps-post'
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/.conda/envs/bamboo/lib/python3.6/site-packages/matplotlib/__init__.py in __setitem__(self, key, val)
    860             try:
--> 861                 cval = self.validate[key](val)
    862             except ValueError as ve:

~/.conda/envs/bamboo/lib/python3.6/site-packages/matplotlib/rcsetup.py in _validate_linestyle(ls)
    949     if isinstance(ls, (str, bytes, bytearray)):
--> 950         return _validate_named_linestyle(ls)
    951

~/.conda/envs/bamboo/lib/python3.6/site-packages/matplotlib/rcsetup.py in __call__(self, s)
     64         raise ValueError('Unrecognized %s string %r: valid strings are %s'
---> 65                          % (self.key, s, list(self.valid.values())))
     66

ValueError: Unrecognized linestyle string 'steps-post': valid strings are ['-', '--', '-.', ':', 'solid', 'dashed', 'dashdot', 'dotted', 'none', ' ', '']

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-3-7f838b7219da> in <module>
----> 1 matplotlib.rcParams['lines.linestyle'] = 'steps-post'

~/.conda/envs/bamboo/lib/python3.6/site-packages/matplotlib/__init__.py in __setitem__(self, key, val)
    861                 cval = self.validate[key](val)
    862             except ValueError as ve:
--> 863                 raise ValueError("Key %s: %s" % (key, str(ve)))
    864             dict.__setitem__(self, key, cval)
    865         except KeyError:

ValueError: Key lines.linestyle: Unrecognized linestyle string 'steps-post': valid strings are ['-', '--', '-.', ':', 'solid', 'dashed', 'dashdot', 'dotted', 'none', ' ', '']

In [4]: print(matplotlib.get_backend())
Qt5Agg

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions