Skip to content

Plotting Hist with histtype 'stepfilled' does not respect bottom correctly #17757

Closed
@claria

Description

@claria

Bug report

Bug summary

Using the bottom argument in matplotlib hist() together with histtype='stepfilled' always results in the first patch is drawn starting from (x,y)=(bins[0], 0). Using histtype='bar' results in the expected outcome.

Code for reproduction

import matplotlib.pyplot as plt

fig, ax = plt.subplots(nrows=2)

x = [1, 1, 1, 2, 2, ]
bins = [1, 1.5, 2, 3]
bottom = [1, 0, 3]

ax[0].hist(x=x, bins=bins, bottom=bottom, histtype='stepfilled')
ax[0].set_ylim(0, 10)

ax[1].hist(x=x, bins=bins, bottom=bottom, histtype='bar')
ax[1].set_ylim(0, 10)

Actual outcome

grafik

Expected outcome

Patch of first bin starting at bottom[0]

Matplotlib version

  • Operating system: Windows
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): nbAgg
  • Python version: 3.6
  • Jupyter version (if applicable):
  • Other libraries:

pip

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