|
From: Daniel H. <dh...@gm...> - 2013-01-01 13:28:49
|
No, I didn't... I believe that in this specific case, I just manually drew a decently sized box around the axis spine and implemented my own contains method to match. It would be nice for every artist to be consistent in this area though. Maybe a MEP is in order to make every artist have a consistent interface as defined by the base class? On Dec 30, 2012 1:00 AM, "Michael McNeil Forbes" < mic...@gm...> wrote: > On 7 Oct 2011, at 4:56 PM, Daniel Hyams wrote: > > 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? >> > > Did you ever find a way to get the bounding box of an artist? I could use > this too. > > Michael. > |