Movable Legend

Hi All,

    a while ago, Che posted a nice example on how to drag a legend
with the mouse. I have upgraded to matplotlib 0.99.1 and it looks like
the nice example is not working anymore: for the life of me I can't
figure out what's wrong. I attach the runnable sample submitted
originally.

Any suggestion regarding what's wrong with the code?

Thank you in advance.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

draggable_legend2.py (5.81 KB)

This is a known bug. While this is fixed in the svn, this did go into
the maint. branch.
As a workaround, add the following line after line 70.

        self.legend.set_axes(self.subplot)

Regards,

-JJ

···

On Mon, Oct 26, 2009 at 9:44 AM, Andrea Gavana <andrea.gavana@...287...> wrote:

Hi All,

a while ago, Che posted a nice example on how to drag a legend
with the mouse. I have upgraded to matplotlib 0.99.1 and it looks like
the nice example is not working anymore: for the life of me I can't
figure out what's wrong. I attach the runnable sample submitted
originally.

Any suggestion regarding what's wrong with the code?

Thank you in advance.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hi Jae-Joon,

2009/10/26 Jae-Joon Lee:

This is a known bug. While this is fixed in the svn, this did go into
the maint. branch.
As a workaround, add the following line after line 70.

   self\.legend\.set\_axes\(self\.subplot\)

Thank you for your help, it works perfectly.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

This movable legend is a good idea on plots, especially if there are many elements on one figure. However a few notes that I would like to add:

1-) So many lines of code. Makes it hard to read when I share the code with someone else. Would be so much better to have a functionality like:
plt.legend(movable=True). I might add this into the feature request page, if one hasn’t submitted yet.

2-) When I move the legend out of a canvas area, I can’t bring back into the canvas, nor move it any longer.

3-) The rest of the toolbox items are gone. How to zoom or pan when I have a moving legend?

Regards,

···

On Tue, Oct 27, 2009 at 10:21 AM, Andrea Gavana <andrea.gavana@…287…> wrote:

Hi Jae-Joon,

2009/10/26 Jae-Joon Lee:

This is a known bug. While this is fixed in the svn, this did go into

the maint. branch.

As a workaround, add the following line after line 70.

   self.legend.set_axes(self.subplot)

Thank you for your help, it works perfectly.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.alice.it/infinity77/

http://thedoomedcity.blogspot.com/


Come build with us! The BlackBerry(R) Developer Conference in SF, CA

is the only developer event you need to attend this year. Jumpstart your

developing skills, take BlackBerry mobile applications to market and stay

ahead of the curve. Join us from November 9 - 12, 2009. Register now!

http://p.sf.net/sfu/devconference


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Gökhan