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


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

Re: 2D Plot for a face of a 3D plot box?

Started byHeike Gramberg <heike.gramberg@gmail.com>
First post2011-11-13 12:18 +0000
Last post2011-11-14 12:09 +0000
Articles 2 — 2 participants

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

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: 2D Plot for a face of a 3D plot box? Heike Gramberg <heike.gramberg@gmail.com> - 2011-11-13 12:18 +0000
    Re: 2D Plot for a face of a 3D plot box? Dan <dflatin@rcn.com> - 2011-11-14 12:09 +0000

#6424 — Re: 2D Plot for a face of a 3D plot box?

FromHeike Gramberg <heike.gramberg@gmail.com>
Date2011-11-13 12:18 +0000
SubjectRe: 2D Plot for a face of a 3D plot box?
Message-ID<j9ocj5$17u$1@smc.vnet.net>
You could use MeshFunctions to draw curves on a 3D surface. For example

f[x_, y_] := Sin[x y];
Plot3D[f[x, y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, PlotPoints -> 40,
 MeshFunctions -> Function[{x, y, z}, (x - Pi)^2 + (y - Pi)^2],
 Mesh -> {{4}},
 MeshStyle -> {Thick, Blue}]

Alternatively, you could use ParametricPlot3D to draw the curve 
separately and use Show to combine the plots, e.g.

Show[{Plot3D[Sin[x y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, Mesh -> None, 
PlotPoints -> 40],
  ParametricPlot3D[{Pi + 2 Cos[t], Pi + 2 Sin[t], f[Pi + 2 Cos[t], Pi + 
2 Sin[t]]},
   {t, 0, 2 Pi},
   PlotStyle -> {Thick, Blue}]}]

You can also use this method to plot graphs on the bounding box of a 3D 
plot. For example

With[{bb = {{0, 2 Pi}, {0, 2 Pi}, {-1.5, 1.5}}},
 Show[{
   Plot3D[Sin[x y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, Mesh -> None, PlotPoints 
-> 40],
   ParametricPlot3D[{Pi + 2 Cos[t], Pi + 2 Sin[t], bb[[3, -1]]},
    {t, 0, 2 Pi},
    PlotStyle ->  {Thick, Red}]},
  PlotRange -> bb]]

Heike

On 13 Nov 2011, at 10:43, Brentt wrote:

> Hello,
>
> Is there a way to have a 2D plot on a face of the bounding box of a 3D
> surface plot? Only ordered pairs in the 2D function would have any opacity
> of course, so the view of the 3D surface won't be obstructed.

[toc] | [next] | [standalone]


#6431

FromDan <dflatin@rcn.com>
Date2011-11-14 12:09 +0000
Message-ID<j9r0df$bfu$1@smc.vnet.net>
In reply to#6424
On Nov 13, 7:18 am, Heike Gramberg <heike.gramb...@gmail.com> wrote:
> You could use MeshFunctions to draw curves on a 3D surface. For example
>
> f[x_, y_] := Sin[x y];
> Plot3D[f[x, y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, PlotPoints -> 40,
>  MeshFunctions -> Function[{x, y, z}, (x - Pi)^2 + (y - Pi)^2],
>  Mesh -> {{4}},
>  MeshStyle -> {Thick, Blue}]
>
> Alternatively, you could use ParametricPlot3D to draw the curve
> separately and use Show to combine the plots, e.g.
>
> Show[{Plot3D[Sin[x y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, Mesh -> None,
> PlotPoints -> 40],
>   ParametricPlot3D[{Pi + 2 Cos[t], Pi + 2 Sin[t], f[Pi + 2 Cos[t], Pi +
> 2 Sin[t]]},
>    {t, 0, 2 Pi},
>    PlotStyle -> {Thick, Blue}]}]
>
> You can also use this method to plot graphs on the bounding box of a 3D
> plot. For example
>
> With[{bb = {{0, 2 Pi}, {0, 2 Pi}, {-1.5, 1.5}}},
>  Show[{
>    Plot3D[Sin[x y], {x, 0, 2 Pi}, {y, 0, 2 Pi}, Mesh -> None, PlotPoints
> -> 40],
>    ParametricPlot3D[{Pi + 2 Cos[t], Pi + 2 Sin[t], bb[[3, -1]]},
>     {t, 0, 2 Pi},
>     PlotStyle ->  {Thick, Red}]},
>   PlotRange -> bb]]
>
> Heike
>
> On 13 Nov 2011, at 10:43, Brentt wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > Is there a way to have a 2D plot on a face of the bounding box of a 3D
> > surface plot? Only ordered pairs in the 2D function would have any opacity
> > of course, so the view of the 3D surface won't be obstructed.

While not exactly what the original poster wanted, here is one more
possibility for combining 2D and 3D plots:

With[{bb={{0,2 Pi},{0,2 Pi},{-1.5,1.5}}},
  Module[{cplot,vtc,cpanecoords},
    cplot=Texture[Rasterize@ContourPlot[Sin[x y],{x,0,2 Pi},{y,0,2
Pi},Frame->False]];
    vtc={{0,0},{1,0},{1,1},{0,1}};
    cpanecoords={{0,0,1.5},{0,2Pi,1.5},{2Pi,2Pi,1.5},{2Pi,0,1.5}};
    Show[{

Graphics3D[{Opacity[0.5],cplot,Polygon[cpanecoords,VertexTextureCoordinates-
>vtc]}],
      Plot3D[Sin[x y],{x,0,2 Pi},{y,0,2 Pi},Mesh->None,PlotPoints->40]
    }]
  ]
]

-- Dan

[toc] | [prev] | [standalone]


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


csiph-web