Skip to content

Unable to use 'ds' keyword in plt.errorbar #20137

Closed

Description

@jeffburggraf

Bug report

Bug summary

In version 3.4.1, passing the 'ds' kwarg to plt.errorbar results in an attribute error.
Code for reproduction

from matplotlib import pyplot as plt
plt.errorbar(x=[1, 2], y=[1, 2], yerr=[1, 2], ds='steps-mid')

Actual outcome

AttributeError: 'LineCollection' object has no property 'drawstyle'

Matplotlib version

  • Operating system: Catalina (10.15.7)
  • Matplotlib version: 3.4.1
  • Matplotlib backend: MacOSX
  • Python version: 3.8.8
  • Other libraries: Fresh conda environment

Installed matplotlib via conda using the default channel.

Activity

  1. jklymak commented on May 2, 2021

    @jklymak
    Member

    Did it ever work? I am not sure what this kwarg is supposed to do for errorbar...

  2. jeffburggraf commented on May 3, 2021

    @jeffburggraf
    Author

    I believe so, at least it worked in the previous version. If it's not suppose to work, then the documentation needs updating.

  3. jklymak commented on May 3, 2021

    @jklymak
    Member

    What do you expect it to do though?

    The kwarg documentation is for markers, which don't use drawstyle. Its unfortunate drawstyle is in there, but its for completeness with other plot calls. Its entirely possible this didn't error before, but I don't think it ever did anything either.

  4. jeffburggraf commented on May 3, 2021

    @jeffburggraf
    Author

    I use the kwarg to produce histograms like this:

    Screenshot 2021-05-02 221241

    I don't know a simple way to replicate the above picture using plt.bar(). I could use plt.stairs() and overlay with plt.errorbar(), but the ds='steps-mid' option is better IMO

  5. anntzer commented on May 3, 2021

    @anntzer
    Contributor

    This was fixed in #19888.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions