On 7/14/10 11:27 AM, David Sanders wrote:

I have been playing with this a bit, and have found some problems.

Firstly, with this code it seems not to be possible to make a
region_plot *without* specifying opacity -- it looks like a default
argument is missing somewhere.


I've noted this on the trac ticket; thanks.


But the main problem is the same one as I started with. Currently,
each region_plot paints the part which is not "inside" the region in
white (by default), as opposed to leaving it "blank". This means that
when opacity != 0.5, the second plot drawn still partially hides the
first.



Ah, so outcol should by default be set to a 100% transparent color?

I'm having difficulty getting matplotlib to draw a contour plot with a color map where one of the colors is transparent.

My preferred behaviour would be simply to not draw anything if, for
example, outcol == None.

Perhaps this is not the right place for this discussion (is that the
sage-devel list?), but I tried to modify the code to do this, by
checking for outcol as follows:

if outcol:
         g.add_primitive(ContourPlot(xy_data_array, xrange,yrange,
                                 dict(contours=[-1e307, 0, 1e307],
cmap=cmap, fill=True, **options)))
else:
         g.add_primitive(ContourPlot(xy_data_array, xrange,yrange,
                                 dict(contours=[-1e307, 0], cmap=cmap,
                                 fill=True, **options)))

(I also checked for it where it is converted to an rgbcolor.)

So if outcol==None, then it should only fill the negative region,
which corresponds to where the arguments are true.

However, I never got this to work, apparently because I don't
understand properly what the cmap object does and how it works.
Directly in matplotlib I did manage to do what I wanted, but not
specifying a cmap. Here I can't seem to get it quite right, but it
seems to me like this is the right direction to go in.

Can somebody enlighten me on cmap?


(yes, I know this is an old thread---I'm catching up...)

How did you get it to work in matplotlib?

The documentation for matplotlib cmaps (i.e., "color maps"---classes that convert a scalar to an rgba color with transparency) is here:

http://matplotlib.sourceforge.net/api/cm_api.html

See also:

http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.Colormap

http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap

http://matplotlib.sourceforge.net/api/colors_api.html#matplotlib.colors.ListedColormap

Thanks,

Jason

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to