Re: Superimposing 3D plots with different colours

*To*: mathgroup at smc.vnet.net*Subject*: [mg74533] Re: [mg74516] Superimposing 3D plots with different colours*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Sat, 24 Mar 2007 05:22:53 -0500 (EST)*Reply-to*: hanlonr at cox.net

Needs["Graphics`"]; DisplayTogether[ Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction->Hue], Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -> (If[# < 0.5, GrayLevel[0.5], GrayLevel[0.8]] &)]]; s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction->Hue,DisplayFunction->Identity]; s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -> (If[# < 0.5, GrayLevel[0.5], GrayLevel[0.8]] &),DisplayFunction->Identity]; Show[{s1, s2},DisplayFunction->$DisplayFunction]; Bob Hanlon ---- Rui Carvalho <ruipcarvalho at gmail.com> wrote: > Hello, > > I need to superimpose two 3D curves and to distinguish them I need to have each in different colours. The code below shows my attempt, but it fails as Show reverts to the colours of the first plot. This is just test code, not the real code I'm working with. > > I don't need a code trick to combine both plots inside Show. > > What I have is two SurfaceGraphics objects, s1 and s2, which have different colours and I want to combine these so that both surfaces can be distinguished by colour. How can this be done? > > > s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi}]; > s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -> (If[# < 0.5, GrayLevel[0.5], GrayLevel[0.8]] &)]; > Show[{s1, s2}]; > > Thanks a lot! > Rui >