Skip to content

[ENH]: Make fill_between 'step' argument consistent with plot #29653

Open
@MichaelClerx

Description

@MichaelClerx

Problem

When I use fill_between, I typically want a plotted line as well. A nice way of doing this on several axes is to use a dict of keyword arguments, e.g.

kw = dict(color: 'red', ls='--', lw=1)
ax.plot(..., **kw)
ax.fill_between(..., **kw)

One thing that can't be set this way is the drawstyle, because for some reason fill_between has its own syntax for this which differs from other methods.

Both the argument name and the way it's processed are different:

  • plot takes drawstyle or ds, with options 'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'
  • fill_between takes step with options 'pre', 'post', 'mid', and requires you to not pass in a step argument to get the default interpolating behaviour

This makes it really annoying to use, especially when automating.

Also has created some confusion in the past: #19524

Proposed solution

  1. Add drawstyle and ds arguments to fill_between, that are processed the same as for plot
  2. Deprecate the step argument to fill_between

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