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

Simplify 3d axes callback setup.#15855

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:3dcb
Mar 9, 2020
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletionslib/mpl_toolkits/mplot3d/axes3d.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,7 +79,6 @@ def __init__(

if rect is None:
rect = [0.0, 0.0, 1.0, 1.0]
self._cids = []

self.initial_azim = azim
self.initial_elev = elev
Expand DownExpand Up@@ -115,6 +114,12 @@ def __init__(
self._zcid = None

self.mouse_init()
self.figure.canvas.mpl_connect(
'motion_notify_event', self._on_move),
self.figure.canvas.mpl_connect(
'button_press_event', self._button_press),
self.figure.canvas.mpl_connect(
'button_release_event', self._button_release),
self.set_top_view()

self.patch.set_linewidth(0)
Expand DownExpand Up@@ -1004,8 +1009,7 @@ def get_proj(self):

def mouse_init(self, rotate_btn=1, zoom_btn=3):
"""
Initializes mouse button callbacks to enable 3D rotation of the axes.
Also optionally sets the mouse buttons for 3D rotation and zooming.
Set the mouse buttons for 3D rotation and zooming.

Parameters
----------
Expand All@@ -1015,20 +1019,16 @@ def mouse_init(self, rotate_btn=1, zoom_btn=3):
The mouse button or buttons to use to zoom the 3D axes.
"""
self.button_pressed = None
self._cids = [
self.figure.canvas.mpl_connect(
'motion_notify_event', self._on_move),
self.figure.canvas.mpl_connect(
'button_press_event', self._button_press),
self.figure.canvas.mpl_connect(
'button_release_event', self._button_release),
]
# coerce scalars into array-like, then convert into
# a regular list to avoid comparisons against None
# which breaks in recent versions of numpy.
self._rotate_btn = np.atleast_1d(rotate_btn).tolist()
self._zoom_btn = np.atleast_1d(zoom_btn).tolist()

def disable_mouse_rotation(self):
"""Disable mouse buttons for 3D rotation and zooming."""
self.mouse_init(rotate_btn=[], zoom_btn=[])

def can_zoom(self):
"""
Return *True* if this axes supports the zoom box button functionality.
Expand DownExpand Up@@ -1069,13 +1069,6 @@ def cla(self):

self.grid(rcParams['axes3d.grid'])

def disable_mouse_rotation(self):
"""Disable mouse button callbacks."""
# Disconnect the various events we set.
for cid in self._cids:
self.figure.canvas.mpl_disconnect(cid)
self._cids = []

def _button_press(self, event):
if event.inaxes == self:
self.button_pressed = event.button
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp