[Date Index]
[Thread Index]
[Author Index]
Re: Superimposing 3D plots with different colours
*To*: mathgroup at smc.vnet.net
*Subject*: [mg74687] Re: Superimposing 3D plots with different colours
*From*: "Jeremy B Maddox" <maddoxjb at gmail.com>
*Date*: Sat, 31 Mar 2007 01:33:26 -0500 (EST)
*References*: <eu1rnv$lag$1@smc.vnet.net>
Try using a different color system (eg HLSColor in the example below)
and scaling the color functions differently between the two plots to
highlight the difference between the two curves, such as
<< Graphics`Colors`
lin[x_, y1_, y2_] := y1 + (y2 - y1)x
s1 = Plot3D[Cos[x*y], {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction ->
(HLSColor[lin[#,0, .15], lin[#, .25, .75], 1] &), DisplayFunction ->
Identity];
s2 = Plot3D[Sin[x*y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction ->
(HLSColor[lin[#, .5, .8], lin[#, .25, .75], 1] &), DisplayFunction ->
Identity];
Show[{s1, s2}, DisplayFunction -> $DisplayFunction];
Jeremy
On Mar 23, 5:35 pm, Rui Carvalho <ruipcarva... 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
Prev by Date:
** Re: ReadList**
Next by Date:
**Re: Re: Re: Multi-core Support in Mathematica 5.2**
Previous by thread:
**Re: Superimposing 3D plots with different colours**
Next by thread:
**Special Projects Associates**
| |