From 859796fafac8a735928c6efd8583ff14c1b55687 Mon Sep 17 00:00:00 2001 From: saksmito Date: Sun, 15 Jul 2018 10:03:33 +0200 Subject: [PATCH 1/2] Update blocking_input.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ginput doesn´t allow to disable buttons. With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan. Only one issue. I´m just starting with python (only worked with matlab and VB, you can tell my proficiency by that alone, so please don´t be too harsh if I made any mistake) and I don´t know if this change in BlockingMouseInput will create a regression issue to any other matplotlib function. Thanks. --- lib/matplotlib/blocking_input.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/blocking_input.py b/lib/matplotlib/blocking_input.py index d5e9257c10fe..b81d98c97452 100644 --- a/lib/matplotlib/blocking_input.py +++ b/lib/matplotlib/blocking_input.py @@ -135,7 +135,7 @@ def mouse_event(self): self.mouse_event_pop(event) elif button == self.button_stop: self.mouse_event_stop(event) - else: + elif self.button_add: self.mouse_event_add(event) def key_event(self): From a6a2d1c4cf180fceebd5f9ddddf5c95d0a56d4db Mon Sep 17 00:00:00 2001 From: saksmito Date: Sun, 15 Jul 2018 10:18:56 +0200 Subject: [PATCH 2/2] Update figure.py Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom --- lib/matplotlib/figure.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 481dc9c5e32f..3374633ebac8 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2139,10 +2139,13 @@ def ginput(self, n=1, timeout=30, show_clicks=True, mouse_add=1, If True, show a red cross at the location of each click. mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click) Mouse button used to add points. + Use a different button value to disable this mouse action. mouse_pop : int, one of (1, 2, 3), optional, default: 3 (right click) Mouse button used to remove the most recently added point. + Use a different button value to disable this mouse action. mouse_stop : int, one of (1, 2, 3), optional, default: 2 (middle click) Mouse button used to stop input. + Use a different button value to disable this mouse action. Returns -------