Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10027 > unrolled thread

How to combine 3D Graphics?

Started byJee Lou <ywdr1987@gmail.com>
First post2012-05-11 04:13 +0000
Last post2012-05-14 05:36 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  How to combine 3D Graphics? Jee Lou <ywdr1987@gmail.com> - 2012-05-11 04:13 +0000
    Re: How to combine 3D Graphics? JUN <noeckel@gmail.com> - 2012-05-13 07:03 +0000
      Re: How to combine 3D Graphics? Jee Lou <ywdr1987@gmail.com> - 2012-05-14 05:36 +0000

#10027 — How to combine 3D Graphics?

FromJee Lou <ywdr1987@gmail.com>
Date2012-05-11 04:13 +0000
SubjectHow to combine 3D Graphics?
Message-ID<joi3lp$n45$1@smc.vnet.net>
I have tried to combine a translucent 3D-plot graph with its density plot by using Show. But it doesn't work. Here's my code:
g1=Plot3D[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Mesh -> False,PlotStyle->Opacity[.5]];
g2=DensityPlot[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Frame -> False];
g3=Plot3D[-1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> None,TextureCoordinateFunction -> ({#1, #2} &), PlotStyle -> Directive[Texture[g2]]];
Show[g1,g3]
It turns out that the density graph disappears T_T.
How can I make it right? 

[toc] | [next] | [standalone]


#10063

FromJUN <noeckel@gmail.com>
Date2012-05-13 07:03 +0000
Message-ID<jonmb7$geb$1@smc.vnet.net>
In reply to#10027
On Thursday, May 10, 2012 9:13:45 PM UTC-7, Jee Lou wrote:
> I have tried to combine a translucent 3D-plot graph with its density plot by using Show. But it doesn't work. Here's my code:
> g1=Plot3D[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Mesh -> False,PlotStyle->Opacity[.5]];
> g2=DensityPlot[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Frame -> False];
> g3=Plot3D[-1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> None,TextureCoordinateFunction -> ({#1, #2} &), PlotStyle -> Directive[Texture[g2]]];
> Show[g1,g3]
> It turns out that the density graph disappears T_T.
> How can I make it right?

Although the plot shows properly in the notebook, I can confirm that it disappears when exporting the result of  Show[g1,g3] as a PDF. To fix this, you could try the following modification:

g3 = Plot3D[-1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> None, 
   TextureCoordinateFunction -> ({#1, #2} &), 
   PlotStyle -> Directive[Texture[ImageData@Rasterize[g2, "Image"]]]];

This is a bug, and the use of ImageData above is a work-around. 

[toc] | [prev] | [next] | [standalone]


#10068

FromJee Lou <ywdr1987@gmail.com>
Date2012-05-14 05:36 +0000
Message-ID<joq5k4$r38$1@smc.vnet.net>
In reply to#10063
On Sunday, May 13, 2012 3:03:03 PM UTC+8, JUN wrote:
> On Thursday, May 10, 2012 9:13:45 PM UTC-7, Jee Lou wrote:
> > I have tried to combine a translucent 3D-plot graph with its density plot by using Show. But it doesn't work. Here's my code:
> > g1=Plot3D[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Mesh -> False,PlotStyle->Opacity[.5]];
> > g2=DensityPlot[Sin[x + y], {x, 0, Pi}, {y, 0, Pi}, Frame -> False];
> > g3=Plot3D[-1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> None,TextureCoordinateFunction -> ({#1, #2} &), PlotStyle -> Directive[Texture[g2]]];
> > Show[g1,g3]
> > It turns out that the density graph disappears T_T.
> > How can I make it right?
> 
> Although the plot shows properly in the notebook, I can confirm that it disappears when exporting the result of  Show[g1,g3] as a PDF. To fix this, you could try the following modification:
> 
> g3 = Plot3D[-1, {x, 0, Pi}, {y, 0, Pi}, Mesh -> None, 
>    TextureCoordinateFunction -> ({#1, #2} &), 
>    PlotStyle -> Directive[Texture[ImageData@Rasterize[g2, "Image"]]]];
> 
> This is a bug, and the use of ImageData above is a work-around.

Your modification does not work either...but thx anyway. I have fixed it by using ColorFunction at last.
code here:
p1 = Plot3D[Sin[x + y], {x, 0, \[Pi]}, {y, 0, \[Pi]}, 
  PlotStyle -> Opacity[.5], Mesh -> False];
p2 = Plot3D[-1, {x, 0, \[Pi]}, {y, 0, \[Pi]}, 
  ColorFunction -> 
   Function[{x, y}, ColorData["Rainbow", (Sin[x + y] + 1)/2]], 
  ColorFunctionScaling -> False, Mesh -> False, PlotPoints -> 30];
Show[p1, p2, PlotRange -> All, ImageSize -> 500]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web