Re: Superimposing 3D plots with different colours

*To*: mathgroup at smc.vnet.net*Subject*: [mg74562] Re: [mg74516] Superimposing 3D plots with different colours*From*: "Rui Carvalho" <ruipcarvalho at gmail.com>*Date*: Mon, 26 Mar 2007 02:07:30 -0500 (EST)*References*: <4011198.1174703316637.JavaMail.root@eastrmwml10>

Thanks Bob, This is interesting, but it changes the ColorFunction from Automatic to Hue, so the final graph does not look so nice. I am quite disappointed with the functionality of Mathematica to create simple plots for scientific publications, I have to say. Most of what I find in books is east of what you need to put in a paper! The example I sent is just a basic combination of plots -why is it so hard to do???!!! Thanks, Rui On 3/24/07, Bob Hanlon <hanlonr at cox.net> wrote: > > 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 > > > > ------=_Part_49895_10083987.1174822300719 Content-Type: text/html; charset="ISO-8859-1" Content-Disposition: inline X-Sun-Content-Length: 2746 Thanks Bob,<br><br>This is interesting, but it changes the ColorFunction from Automatic to Hue, so the final graph does not look so nice.<br><br>I am quite disappointed with the functionality of Mathematica to create simple plots for scientific publications, I have to say. Most of what I find in books is east of what you need to put in a paper! The example I sent is just a basic combination of plots -why is it so hard to do???!!! <br><br>Thanks,<br><span class="sg">Rui</span><br><br><div><span class="gmail_quote">On 3/24/07, <b class="gmail_sendername">Bob Hanlon</b> <<a href="mailto:hanlonr at cox.net">hanlonr at cox.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Needs["Graphics`"];<br><br>DisplayTogether[<br> Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi},<br> ColorFunction->Hue],<br> Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi},<br> ColorFunction -> (If[# < 0.5,<br> GrayLevel[0.5], GrayLevel[0.8]] &)]];<br><br>s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi},<br> ColorFunction->Hue,DisplayFunction->Identity];<br>s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -> (If[# < 0.5,<br><br> GrayLevel[0.5], GrayLevel[0.8]] &),DisplayFunction->Identity];<br>Show[{s1, s2},DisplayFunction->$DisplayFunction];<br><br><br>Bob Hanlon<br><br>---- Rui Carvalho <<a href="mailto:ruipcarvalho at gmail.com"> ruipcarvalho at gmail.com</a>> wrote:<br>> Hello,<br>><br>> 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. <br>><br>> I don't need a code trick to combine both plots inside Show.<br>><br>> 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? <br>><br>><br>> s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi}];<br>> s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -> (If[# < 0.5, GrayLevel[0.5], GrayLevel[0.8]] &)];<br>> Show[{s1, s2}]; <br>><br>> Thanks a lot!<br>> Rui<br>><br><br></blockquote></div><br> ------=_Part_49895_10083987.1174822300719--