Skip to content

[Bug]: Histogram ignores lw argument, no warning or error #29977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gullbrekken opened this issue Apr 28, 2025 · 1 comment
Closed

[Bug]: Histogram ignores lw argument, no warning or error #29977

gullbrekken opened this issue Apr 28, 2025 · 1 comment

Comments

@gullbrekken
Copy link

Bug summary

ax.hist ignores lw argument. Must use linewidth in order to change the thickness of the lines.

Code for reproduction

# Test of lw vs linewidth in histograms

histogram1 = [1]
histogram2 = [3]
histogram3 = [5]

fig, ax = plt.subplots(figsize=(8, 8))
ax.hist(histogram1, bins=1, density=True, histtype='step', color='tab:blue', lw=1, label='lw=1')
ax.hist(histogram2, bins=1, density=True, histtype='step', color='tab:orange', lw=3, label='lw=3')
ax.hist(histogram3, bins=1, density=True, histtype='step', color='tab:green', linewidth=3, label='linewidth=3')
ax.legend()

plt.show()

print(matplotlib.__version__)

Actual outcome

Image

Expected outcome

Using lw and linewidth produce same output.

Additional information

This was not a problem with an earlier version of Matplotlib (don't remember the version unfortunately, but definitely 3.x something).

Operating system

Ubuntu 24.04.2 LTS

Matplotlib Version

3.10.0

Matplotlib Backend

agg

Python version

3.12.3

Jupyter version

4.2.5

Installation

pip

@rcomer
Copy link
Member

rcomer commented Apr 28, 2025

Thanks @gullbrekken for the report. This has already been fixed ready for the next release by #29552.

@rcomer rcomer closed this as completed Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants