I want to know how to create a popup box in a basemap plot. When I hover my mouse over a location , it should trigger the popup box.
Is this possible?
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.
Yes it is possible thanks to matplotlib’s event handling framework. I couldn’t find an already written example which does what you are particularly interested in so I wrote one (which I will put forward for inclusion in the matplotlib source).
I would read http://matplotlib.sourceforge.net/users/event_handling.html thoroughly to best understand what is going on. Please note that although it sounds like the perfect solution “pick_event” is for mouse clicks -not for mouse over- events and doesn’t work in this case.
My code, which could be objectified very nicely should one want, looks like:
Hopefully everything should be fairly readable. A high level overview of the code goes: