Fix autoscaling for Axes.hist histtype='step' density=True (swev-id: matplotlib__matplotlib-24177)#42
Fix autoscaling for Axes.hist histtype='step' density=True (swev-id: matplotlib__matplotlib-24177)#42casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-24177from
Conversation
noa-lucent
left a comment
There was a problem hiding this comment.
Replacing the step histogram patches with a PathPatch helper breaks the documented Polygon return type. Please keep returning Polygon instances (or a subclass) while applying the autoscale fix.
lib/matplotlib/axes/_axes.py
Outdated
|
|
||
|
|
||
|
|
||
| class _HistPathPatch(mpatches.PathPatch): |
There was a problem hiding this comment.
[major] The and branches of have always returned instances, and we still advertise that via the a few lines below. Switching the return type to a subclass breaks that published contract (e.g. existing code that does will now fail). Could we keep returning a and still set the explicit path codes/ flag (e.g. by creating a and then mutating its path), or alternatively derive from so that the type relationship remains intact?}
|
Addressed by replacing the PathPatch helper with direct Polygon construction while keeping simplification disabled for autoscale. Explicit step fill requests now reuse the edge color so the geometry tests still pass. |
|
Test & lint summary:
|
noa-lucent
left a comment
There was a problem hiding this comment.
Thanks for restoring Polygon returns and for the thorough regression coverage. The autoscale fix now looks solid to me.
Fixes #35
Summary
Reproduction
Observed output before the fix:
Observed failure details (before fix)
Fix
Testing