4
4
matplotlib .rcParams ['toolbar' ] = 'navigation'
5
5
import matplotlib .pyplot as plt
6
6
from matplotlib .backend_tools import ToolBase
7
-
7
+ from pydispatch import dispatcher
8
8
9
9
# Create a simple tool to list all the tools
10
10
class ListTools (ToolBase ):
@@ -14,7 +14,7 @@ class ListTools(ToolBase):
14
14
15
15
def trigger (self , event ):
16
16
tools = self .navigation .get_tools ()
17
-
17
+
18
18
print ('_' * 80 )
19
19
print ("{0:12} {1:45} {2}" .format ('Name (id)' ,
20
20
'Tool description' ,
@@ -25,7 +25,7 @@ def trigger(self, event):
25
25
print ("{0:12} {1:45} {2}" .format (name ,
26
26
tools [name ]['description' ],
27
27
keys ))
28
- print ('_' * 80 )
28
+ print ('_' * 80 )
29
29
30
30
31
31
# A simple example of copy canvas
@@ -45,15 +45,19 @@ def trigger(self, event):
45
45
clipboard .set_image (pb )
46
46
47
47
48
+
49
+
50
+
48
51
fig = plt .figure ()
49
52
plt .plot ([1 , 2 , 3 ])
50
53
51
54
# Add the custom tools that we created
52
55
fig .canvas .manager .navigation .add_tool ('List' , ListTools )
53
56
if matplotlib .rcParams ['backend' ] == 'GTK3Cairo' :
54
57
fig .canvas .manager .navigation .add_tool ('copy' , CopyToolGTK3 )
55
- #
56
- # Just for fun, lets remove the forward button
57
- fig .canvas .manager .navigation .remove_tool ('forward' )
58
+
59
+ # # Just for fun, lets remove the forward button
60
+ # fig.canvas.manager.navigation.remove_tool('forward')
61
+
58
62
59
63
plt .show ()
0 commit comments