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

Commit011d12f

Browse files
authored
Merge pull request#30349 from anntzer/no-axes-set_navigate_mode
Axes can't set navigate_mode.
2 parentsb2e8b93 +8355ee7 commit011d12f

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``Axes.set_navigate_mode`` is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... with no replacement.

‎lib/matplotlib/axes/_base.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ def __init__(self, fig,
724724
self.fmt_ydata=None
725725

726726
self.set_navigate(True)
727-
self.set_navigate_mode(None)
728727

729728
ifxscale:
730729
self.set_xscale(xscale)
@@ -4187,17 +4186,22 @@ def get_navigate_mode(self):
41874186
"""
41884187
Get the navigation toolbar button status: 'PAN', 'ZOOM', or None.
41894188
"""
4190-
returnself._navigate_mode
4189+
toolbar=self.figure.canvas.toolbar
4190+
iftoolbar:
4191+
returnNoneiftoolbar.mode.name=="NONE"elsetoolbar.mode.name
4192+
manager=self.figure.canvas.manager
4193+
ifmanagerandmanager.toolmanager:
4194+
mode=manager.toolmanager.active_toggle.get("default")
4195+
returnNoneifmodeisNoneelsemode.upper()
41914196

4197+
@_api.deprecated("3.11")
41924198
defset_navigate_mode(self,b):
41934199
"""
41944200
Set the navigation toolbar button status.
41954201
41964202
.. warning::
41974203
This is not a user-API function.
4198-
41994204
"""
4200-
self._navigate_mode=b
42014205

42024206
def_get_view(self):
42034207
"""

‎lib/matplotlib/backend_bases.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,10 +2763,6 @@ class _Mode(str, Enum):
27632763
def__str__(self):
27642764
returnself.value
27652765

2766-
@property
2767-
def_navigate_mode(self):
2768-
returnself.nameifselfisnot_Mode.NONEelseNone
2769-
27702766

27712767
classNavigationToolbar2:
27722768
"""
@@ -3037,8 +3033,6 @@ def pan(self, *args):
30373033
else:
30383034
self.mode=_Mode.PAN
30393035
self.canvas.widgetlock(self)
3040-
forainself.canvas.figure.get_axes():
3041-
a.set_navigate_mode(self.mode._navigate_mode)
30423036

30433037
_PanInfo=namedtuple("_PanInfo","button axes cid")
30443038

@@ -3099,8 +3093,6 @@ def zoom(self, *args):
30993093
else:
31003094
self.mode=_Mode.ZOOM
31013095
self.canvas.widgetlock(self)
3102-
forainself.canvas.figure.get_axes():
3103-
a.set_navigate_mode(self.mode._navigate_mode)
31043096

31053097
_ZoomInfo=namedtuple("_ZoomInfo","button start_xy axes cid cbar")
31063098

‎lib/matplotlib/backend_tools.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,6 @@ def disable(self, event=None):
668668
deftrigger(self,sender,event,data=None):
669669
self.toolmanager.get_tool(_views_positions).add_figure(self.figure)
670670
super().trigger(sender,event,data)
671-
new_navigate_mode=self.name.upper()ifself.toggledelseNone
672-
foraxinself.figure.axes:
673-
ax.set_navigate_mode(new_navigate_mode)
674671

675672
defscroll_zoom(self,event):
676673
# https://gist.github.com/tacaswell/3144287

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp