Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

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> &lt;<a href="mailto:hanlonr at cox.net">hanlonr at cox.net</a>&gt; 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[&quot;Graphics`&quot;];<br><br>DisplayTogether[<br>&nbsp;&nbsp;&nbsp;&nbsp; Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ColorFunction-&gt;Hue],<br>&nbsp;&nbsp;&nbsp;&nbsp;Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ColorFunction -&gt; (If[# &lt; 
0.5,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GrayLevel[0.5], GrayLevel[0.8]] &amp;)]];<br><br>s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ColorFunction-&gt;Hue,DisplayFunction-&gt;Identity];<br>s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -&gt; (If[# &lt; 
0.5,<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GrayLevel[0.5], GrayLevel[0.8]] &amp;),DisplayFunction-&gt;Identity];<br>Show[{s1, s2},DisplayFunction-&gt;$DisplayFunction];<br><br><br>Bob Hanlon<br><br>---- Rui&nbsp;&nbsp;Carvalho &lt;<a href="mailto:ruipcarvalho at gmail.com">
ruipcarvalho at gmail.com</a>&gt; wrote:<br>&gt; Hello,<br>&gt;<br>&gt; 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&#39;m working with.
<br>&gt;<br>&gt; I don&#39;t need a code trick to combine both plots inside Show.<br>&gt;<br>&gt; What I have is two SurfaceGraphics objects, s1 and s2, which have different colours and I want to combine these so that&nbsp;&nbsp;both surfaces can be distinguished by colour. How can this be done?
<br>&gt;<br>&gt;<br>&gt; s1 = Plot3D[Cos[x y], {x, -Pi, Pi}, {y, -Pi, Pi}];<br>&gt; s2 = Plot3D[Sin[x y], {x, -Pi, Pi}, {y, -Pi,Pi}, ColorFunction -&gt; (If[# &lt; 0.5, GrayLevel[0.5], GrayLevel[0.8]] &amp;)];<br>&gt; Show[{s1, s2}];
<br>&gt;<br>&gt; Thanks a lot!<br>&gt; Rui<br>&gt;<br><br></blockquote></div><br>

------=_Part_49895_10083987.1174822300719--


  • Prev by Date: Re: Re: Re: Which Mathematica product
  • Next by Date: Re: Re: No O Reilly Mathematica Cookbook
  • Previous by thread: Re: Superimposing 3D plots with different colours
  • Next by thread: Re: Superimposing 3D plots with different colours