Sorry, It's hard to track down what's wrong without actually running the code.
Change self.legend._loc = loc_in_norm_axes to self.legend._loc = tuple(loc_in_norm_axes) and see if it works. You need to call canvas.draw. However, it will draw whole figure again. If you're concerned about speed, you may consider to use blit method. http://matplotlib.sourceforge.net/examples/animation/animation_blit_wx.html -JJ On Wed, Mar 25, 2009 at 10:55 PM, C M <cmpyt...@gmail.com> wrote: > On Wed, Mar 25, 2009 at 9:58 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: >> Ah, my bad. >> >> Try >> >> self.legend.parent.transAxes.inverted().transform_point(loc_in_canvas) >> >> legend.parent points to the parent axes. >> >> -JJ >> > > That cleared up the error, thanks. But it is still not actually moving the > legend. The coordinates are changing as you described it: > > loc position (JJ method) = [ 0.89354419 0.91002415] > motion_event.x = 436 > motion_event.y = 349.0 > mouse moved x = 31 > mouse moved y = 3.0 > loc position (JJ method) = [ 0.90698505 0.91002415] > > but the legend doesn't move. > > I have tried to different ways of doing the draw method. > > 1. self.canvas.draw() > That gives this error and does not move the legend: > ValueError: The truth value of an array with more than one element is > ambiguous. Use a.any() or a.all() > > 2. self.draw() (this is a method which draws the lines and legend > originally in my class). > That just does nothing, though the output is as shown above. > > What do I have to do to actually show the repositioned legend? > > Thanks for your patience, > C > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users