Re: combining two contour plots
- To: mathgroup at smc.vnet.net
- Subject: [mg47341] Re: combining two contour plots
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 6 Apr 2004 06:36:23 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <c4rdgn$mc9$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, with your coed below gg = Cases[Graphics[#], {_RGBColor, _Polygon, __}, Infinity] & /@ {plot2, plot1}; Show[Graphics[gg, AspectRatio -> Automatic]] Regards Jens Vassilis Spanos wrote: > > Hi, > > I read the archives, but unfortunately I didn't find an answer to > a problem I face. I want to combine to colored regions made > with ContourPlot function, and using Show one covers totally > another, presumably because white is really white color and > not transparent. > > Thanks a lot, > > Vassilis Spanos > > Here is what I am doing ... > > colfun[contourvals_, colorlist_][z_] := Module[{i}, > If[z > Last[contourvals], Return[Last[colorlist]]]; > i = 1; > While[z > contourvals[[i]], i++]; > colorlist[[i]]] > > contourvals = {1., 2., 4.}; > colorlist = {White, RoyalBlue, Yellow, White}; > > plot1 = ContourPlot[x^2 + y^2, {x, -3., 3}, {y, -3., 3.}, > Contours -> contourvals, > ColorFunction -> colfun[contourvals, colorlist], > ColorFunctionScaling -> False, ContourShading -> True, > PlotPoints -> 25]; > > contourvals = {0.5, 1., 3.}; > colorlist = {White, Green, HotPink, White}; > plot2 = ContourPlot[x^2 - y^2, {x, -3., 3}, {y, -3., 3.}, > Contours -> contourvals, > ColorFunction -> colfun[contourvals, colorlist], > ColorFunctionScaling -> False, ContourShading -> True, > PlotPoints -> 25]; > > Show[plot2, plot1]