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

Commit27661fa

Browse files
committed
Fix case where axis limits are reversed
1 parent5e162fb commit27661fa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎lib/matplotlib/widgets.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,12 +3654,23 @@ def _clip_to_axes(self, x, y):
36543654

36553655
min_lim= (xlim[0],ylim[0])
36563656
max_lim= (xlim[1],ylim[1])
3657+
36573658
# Axes limits in display coordinates
36583659
min_lim=self.ax.transData.transform(min_lim)
36593660
max_lim=self.ax.transData.transform(max_lim)
36603661

3662+
# For axes where the limits are reversed, need to make sure the
3663+
# display min/max are in the correct order.
3664+
3665+
ifmin_lim[0]>max_lim[0]:
3666+
min_lim[0],max_lim[0]=max_lim[0],min_lim[0]
3667+
3668+
ifmin_lim[1]>max_lim[1]:
3669+
min_lim[1],max_lim[1]=max_lim[1],min_lim[1]
3670+
36613671
x=np.clip(x,min_lim[0],max_lim[0])
36623672
y=np.clip(y,min_lim[1],max_lim[1])
3673+
36633674
returnx,y
36643675

36653676
# TODO: _draw_shape can be removed in 3.7

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp