On 7/13/10 4:46 AM, David Sanders wrote:
Hi,

I need to superimpose several region_plot's. These have regions
colored in different colors which may or may not overlap. However, if
I do something like

var('p q')
plot1 = region_plot([p+q<1, p+q>-1], (p,-2,2), (q,-2,2), incol='red')
plot2 = region_plot([p-q<1, p-q>-1], (p,-2,2), (q,-2,2), incol='blue')
show(plot1+plot2)

then I see at most the outline of the first plot. It seems that the
second plot covers up the first plot, since the default value of
outcol is 'white'.

Is there any way to make these plots transparent (i.e. with an alpha
value less than 1), or at least not opaque? I tried putting the
option

outcol=None

but this is not accepted. This would seem to me to be the first way of
solving the issue.

I had a look at the code for region_plot, which I at least understand
the idea of. It uses matplotlib for the graphics, so perhaps the
question of transparency is a matplotlib question. Nonetheless, I
believe that matplotlib does have this capability, so this should be
possible...!


It seems that adding transparency is a natural way to do this. I've posted a rough patch to do this up at http://trac.sagemath.org/sage_trac/ticket/9491

I've also attached a figure resulting from:

var('p q')
plot1 = region_plot([p+q<1, p+q>-1], (p,-2,2), (q,-2,2), incol='red', opacity=0.5) plot2 = region_plot([p-q<1, p-q>-1], (p,-2,2), (q,-2,2), incol='blue', opacity=0.5)
show(plot1+plot2)

Sorry I don't have right now to finish the patch and ask for review; I'm rushing out the door.

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

<<attachment: regionplot.png>>

Reply via email to