Skip to content

plt.step(..., where="auto") #5855

Closed
Closed
@anntzer

Description

@anntzer

I would like to suggest adding a fourth option for the where kwarg of plt.step: where="auto". This would take x and y arguments which differ by 1 (in either way) in length, and make a step plot that either has horizontal segments at both ends (if len(x) == len(y) + 1) or has vertical segments at both ends (if len(y) == len(x) + 1).

As far as I know, currently, to make such a plot one must manually duplicate either the first or the last value in the shorter of the two arrays, which is a bit awkward. Additionally, "auto"-mode would make it much easier to rotate such a plot by 90° (in the "vertical" direction): you'd just have to switch the x and y arguments, without worrying about whether you need to change where or which element to duplicate.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesNew feature

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions