Skip to content

axes.errorbar doesn't follow property cycle #9922

Closed
@as691454

Description

@as691454

Bug report

Bug summary
Processing default fmt='' named parameter, errorbar falls back to rcParams linestyle
If property cycle includes dotted or dashed lines they are ignored

Code for reproduction

import matplotlib.pyplot as plt
plt.rc("axes", prop_cycle = 'cycler(linestyle=["-","--",":"])'
plt.errorbar(x=[1,3,4],y=[1,2,3],yerr=0.5)
plt.errorbar(x=[1,3,4],y=[0,1,2],yerr=0.5)
plt.show()

Actual outcome
all lines are solid

Possible solution is to start with an empty dictionary if fmt parameter is an empty line
instead of lines 2880-2882 in axes/_axes.py put the following

        if fmt=='':
            fmt_style_kwargs={}
        else:
            fmt_style_kwargs = {k: v for k, v in
                            zip(('linestyle', 'marker', 'color'),
                                _process_plot_format(fmt)) if v is not None}

Because code queries the property cycle, I assume it was intended to pick up the values, not override them after processing an empty fmt line.
Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 2.1.0
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6.2
  • Jupyter version (if applicable): 5.2.2
  • Other libraries:

WinPython

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions