Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7997be

Browse files
QuLogicmeeseeksmachine
authored andcommitted
Backport PR#28393: Make sticky edges only apply if the sticky edge is the most extreme limit point
1 parent452626f commitc7997be

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

‎lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2969,9 +2969,15 @@ def handle_single_axis(
29692969
# Index of largest element < x0 + tol, if any.
29702970
i0=stickies.searchsorted(x0+tol)-1
29712971
x0bound=stickies[i0]ifi0!=-1elseNone
2972+
# Ensure the boundary acts only if the sticky is the extreme value
2973+
ifx0boundisnotNoneandx0bound>x0:
2974+
x0bound=None
29722975
# Index of smallest element > x1 - tol, if any.
29732976
i1=stickies.searchsorted(x1-tol)
29742977
x1bound=stickies[i1]ifi1!=len(stickies)elseNone
2978+
# Ensure the boundary acts only if the sticky is the extreme value
2979+
ifx1boundisnotNoneandx1bound<x1:
2980+
x1bound=None
29752981

29762982
# Add the margin in figure space and then transform back, to handle
29772983
# non-linear scales.

‎lib/matplotlib/tests/test_axes.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,25 @@ def test_sticky_shared_axes(fig_test, fig_ref):
682682
ax0.pcolormesh(Z)
683683

684684

685+
@image_comparison(['sticky_tolerance.png'],remove_text=True,style="mpl20")
686+
deftest_sticky_tolerance():
687+
fig,axs=plt.subplots(2,2)
688+
689+
width=.1
690+
691+
axs.flat[0].bar(x=0,height=width,bottom=20000.6)
692+
axs.flat[0].bar(x=1,height=width,bottom=20000.1)
693+
694+
axs.flat[1].bar(x=0,height=-width,bottom=20000.6)
695+
axs.flat[1].bar(x=1,height=-width,bottom=20000.1)
696+
697+
axs.flat[2].barh(y=0,width=-width,left=-20000.6)
698+
axs.flat[2].barh(y=1,width=-width,left=-20000.1)
699+
700+
axs.flat[3].barh(y=0,width=width,left=-20000.6)
701+
axs.flat[3].barh(y=1,width=width,left=-20000.1)
702+
703+
685704
deftest_nargs_stem():
686705
withpytest.raises(TypeError,match='0 were given'):
687706
# stem() takes 1-3 arguments.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp