|
From: <And...@gt...> - 2009-01-30 16:27:17
|
> -----Original Message----- > From: John Hunter [mailto:jd...@gm...] > > On Fri, Jan 30, 2009 at 8:54 AM, <And...@gt...> wrote: > > > This is a very timely question for me. I'm needing to do something > very similar, but I need to overlay a semi-transparent rectangle with a > hole cut out of it. So, I'm making a rectangular patch, making a > circular patch, setting the circular patch as the clip region for the > rectangular patch, and then adding the clipped patch to the plot. > However, I seem to be having trouble with the coordinate system, as > there is no clipping on the rectangle. > > > > My test code looks like this: > > > r.set_clip_path(cutout) > > ax.add_patch(r) > > plt.show() > > > The problem is that the "add_patch" command is setting the clippath to > the axes bounding box. I just committed a patch on the branch and > trunk which only sets the clippath to the default if it is not already > set. If you don't have access to svn, just make the call to > r.set_clip_path *after* you call ax.add_patch. > > JDH Hmm ... this doesn't quite give me what I'm looking for. When I do that, I get a semitransparent circle that is clipped to a rectangle. What I need is a semi-transparent rectangle (with a hole cut out of the middle) that overlays the plot. The attached graphic demonstrates the concept. Thanks for the response. |