I’m drawing a legend on an axes object in matplotlib but the default positioning which claims to place it in a smart place doesn’t seem to work. Ideally, I’d like to have the legend be draggable by the user. How can this be done?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Note: This is now built into matplotlib
will work as expected
Well, I found bits and pieces of the solution scattered among mailing lists. I’ve come up with a nice modular chunk of code that you can drop in and use… here it is:
…and in your code…
I emailed the Matplotlib-users group and John Hunter was kind enough to add my solution it to SVN HEAD.
I hope this is helpful to people working with matplotlib.