Skip to content

For hist() with uneven bins, histtype=bar and stepfilled interpret align=left/right differently #12494

@anntzer

Description

@anntzer

Bug report

Bug summary

I'm not really sure what align=left/right is even supposed to mean for uneven bins, but at least histype=bar/stepfilled should interpret them in the same manner (or both should error out).

Code for reproduction

from pylab import *

np.random.seed(0)
t = np.random.rand(100)
fig, axs = plt.subplots(3, 2, sharex=True, sharey=True)
for i, align in enumerate(["left", "mid", "right"]):
    for j, ht in enumerate(["bar", "stepfilled"]):
        axs[i, j].hist(t, [0, 1/4, 1], histtype=ht, align=align)
        axs[i, j].set(xlabel=f"histtype={ht!r}", ylabel=f"align={align!r}")
        axs[i, j].label_outer()

plt.show()

Actual outcome

test

Expected outcome

Either consistent plots with both histtypes, or an error indicating that align=left/right is incompatible with uneven bins.

Matplotlib version

  • Operating system:
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version:
  • Jupyter version (if applicable):
  • Other libraries:

Noted while thinking about #12493.

Metadata

Metadata

Assignees

No one assigned

    Labels

    keepItems to be ignored by the “Stale” Github Actiontopic: hist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy