Hi: I attach a pcolor plot. I would like to get rid of the
> areas outside the larger circle and inside the smaller
> circle. Ideally I would like them to be white. Currently I
> create my plot using pcolor and then plot *lots* of white
> circles (for the inside) and lines (for the outside) on
> top, to get rid of the unwanted areas. This works but I
> wonder whether there is a better/faster solution. I would
> imagine I could set the values corresponding to the
> unwanted areas to some particular color before I call
> pcolor, but the issue is that I want those ares to be white
> (or other color not included in the standard palette which
> is used for plotting the area inside the annulus). Can this
> be done?
Inside the circle is easy - just set the facecolor of the circle to be
white 'w', or whatever rgb tuple you want. How are you creating the
circles, with plot, scatter, or instantiating your own Circle
Outside the circle requires implementing general clipping, which will
be done but I can't say how soon right now. What backend are you
using? The circles don't look antialiased so I'm guessing not agg.
agg and postscript are probably the best bets for getting general
clipping support first.
Another question: is there a reason you are using pcolor rather than
imshow? imshow will give you the same result with interpolation and
dramatic performance benefits. Since you aren't using faceted shading
or otherwise tweaking the pcolor rectangles, you don't gain anything
by using pcolor unless you need a backend that doesn't support imshow
> Another question is in regards to showing tics in pcolor
> plots. In my "legend" on the right, I would like them to be
> visible, but they get overwritten. I suppose I could plot
> each manually after I do pcolor; is it how this is meant to
> be done?
This is an easy fix. Basically you just need to move the axis drawing
to the end of the axes drawing code. Currently it is done before any
before any lines or patches are drawn. Try replacing
matplotlib.Axes._draw with the code below.
I'll make a deal: if you contribute some code to produce the nice
color legend you made, I'll try and implement general clipping!
def _draw(self, renderer, *args, **kwargs):
"Draw everything (plot lines, axes, labels)"
if not ( self.xaxis.viewlim.defined() and
if self._frameon: self._axesPatch.draw(renderer)
if self._image is not None:
for p in self._patches:
for line in self._lines:
for t in self._text:
if 0: bbox_artist(self._title, renderer)
# optional artists
for a in self._artists:
if self._legend is not None:
for table in self._tables: