@@ -131,7 +131,7 @@ def root_locus(sys, kvect=None, xlim=None, ylim=None, plotstr='-', Plot=True,
131131 'button_release_event' , partial (_RLFeedbackClicksPoint ,sys = sys ,fig = f ))
132132
133133 elif sisotool == True :
134- f .axes [1 ].plot ([root .real for root in start_mat ], [root .imag for root in start_mat ], 'm.' , marker = 's' , markersize = 8 ,zorder = 20 )
134+ f .axes [1 ].plot ([root .real for root in start_mat ], [root .imag for root in start_mat ], 'm.' , marker = 's' , markersize = 8 ,zorder = 20 , label = 'gain_point' )
135135 f .suptitle ("Clicked at: %10.4g%+10.4gj gain: %10.4g damp: %10.4g" % (start_mat [0 ][0 ].real , start_mat [0 ][0 ].imag , 1 , - 1 * start_mat [0 ][0 ].real / abs (start_mat [0 ][0 ])),fontsize = 12 if int (matplotlib .__version__ [0 ]) == 1 else 10 )
136136 f .canvas .mpl_connect (
137137 'button_release_event' ,partial (_RLFeedbackClicksSisotool ,sys = sys , fig = f , bode_plot_params = kwargs ['bode_plot_params' ],tvect = kwargs ['tvect' ]))
@@ -380,7 +380,6 @@ def _RLFeedbackClicksSisotool(event,sys,fig,bode_plot_params,tvect):
380380def _RLFeedbackClicksPoint (event ,sys ,fig ,ax_rlocus = None ,sisotool = False ):
381381 """Display root-locus gain feedback point for clicks on the root-locus plot
382382 """
383- print (event )
384383 if sisotool == False :
385384 ax_rlocus = fig .axes [0 ]
386385
@@ -397,17 +396,17 @@ def _RLFeedbackClicksPoint(event,sys,fig,ax_rlocus=None,sisotool=False):
397396
398397 # Remove the previous points
399398 for line in reversed (ax_rlocus .lines ):
400- if len (line .get_xdata ()) == 1 :
399+ if len (line .get_xdata ()) == 1 and line . get_label () == 'gain_point' :
401400 line .remove ()
402401 del line
403402
404403 # Visualise clicked point, display all roots for sisotool mode
405404 if sisotool :
406405 mymat = _RLFindRoots (nump , denp , K .real )
407406 ax_rlocus .plot ([root .real for root in mymat ], [root .imag for root in mymat ], 'm.' , marker = 's' , markersize = 8 ,
408- zorder = 20 )
407+ zorder = 20 , label = 'gain_point' )
409408 else :
410- ax_rlocus .plot (s .real , s .imag , 'k.' , marker = 's' , markersize = 8 , zorder = 20 )
409+ ax_rlocus .plot (s .real , s .imag , 'k.' , marker = 's' , markersize = 8 , zorder = 20 , label = 'gain_point' )
411410
412411 # Update the canvas
413412 fig .canvas .draw ()
0 commit comments