I'm wanting to highlight the artist under the cursor with a transparent
Rectangle patch.  To do this, I have very, roughly, in a mouse motion
handler,

under = self.figure.hitlist(ev)
if under:
   artist = under[0]
   bbox = artist.get_window_extent()
   highlight =
matplotlib.patches.Rectangle(xy=bbox.min,width=bbox.width,height=bbox.height,alpha=0.2,color='yellow')
   # further code to blit the last captured graph region with highlight
drawn on top

The main problem is that all artists don't implement get_window_extent(); a
Text object does, and a legend object does, but the Axis objects do not.

So is there a general way to get the bounding box of an artist?  I looked
through the API and didn't see anything there.  I thought this would be easy
to get to, since almost (every?) artist implements contains().  But it looks
like in the case of XAxis, anyway, that the "hitbox" is being calculated on
the fly in XAxis.contains().


-- 
Daniel Hyams
dhy...@gmail.com
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to