44matplotlib .rcParams ['toolbar' ] = 'navigation'
55import matplotlib .pyplot as plt
66from matplotlib .backend_tools import ToolBase
7-
7+ from pydispatch import dispatcher
88
99# Create a simple tool to list all the tools
1010class ListTools (ToolBase ):
@@ -14,7 +14,7 @@ class ListTools(ToolBase):
1414
1515 def trigger (self , event ):
1616 tools = self .navigation .get_tools ()
17-
17+
1818 print ('_' * 80 )
1919 print ("{0:12} {1:45} {2}" .format ('Name (id)' ,
2020 'Tool description' ,
@@ -25,7 +25,7 @@ def trigger(self, event):
2525 print ("{0:12} {1:45} {2}" .format (name ,
2626 tools [name ]['description' ],
2727 keys ))
28- print ('_' * 80 )
28+ print ('_' * 80 )
2929
3030
3131# A simple example of copy canvas
@@ -45,15 +45,19 @@ def trigger(self, event):
4545 clipboard .set_image (pb )
4646
4747
48+
49+
50+
4851fig = plt .figure ()
4952plt .plot ([1 , 2 , 3 ])
5053
5154# Add the custom tools that we created
5255fig .canvas .manager .navigation .add_tool ('List' , ListTools )
5356if matplotlib .rcParams ['backend' ] == 'GTK3Cairo' :
5457 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+
5862
5963plt .show ()
0 commit comments