Skip to content

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

Open

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.

Activity

  1. github-actions commented on Nov 3, 2023

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  2. added
    keepItems to be ignored by the “Stale” Github Action
    and removed
    status: inactiveMarked by the “Stale” Github Action
    on Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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