MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

combining two contour plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47320] combining two contour plots
  • From: Vassilis Spanos <spanos at physics.umn.edu>
  • Date: Mon, 5 Apr 2004 05:22:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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]


  • Prev by Date: Re:l Re: Consolidated method for solution of strange character in
  • Next by Date: Re: NDSolve for Newtonian Orbits Question
  • Previous by thread: Re:l Re: Consolidated method for solution of strange character in
  • Next by thread: Re: combining two contour plots