MathGroup Archive 2007

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

Search the Archive

Superimposing 3D plots with different colours

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74516] Superimposing 3D plots with different colours
  • From: Rui Carvalho <ruipcarvalho at gmail.com>
  • Date: Fri, 23 Mar 2007 19:17:00 -0500 (EST)
  • Organization: The Math Forum

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


  • Prev by Date: Re: notebook as TXT [solved]
  • Next by Date: Re: Advice for writing small Scheme interpreter
  • Previous by thread: Re: notebook as TXT [solved]
  • Next by thread: Re: Superimposing 3D plots with different colours