MathGroup Archive 1998

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

Search the Archive

Re: Stack graphics


I hope you get simpler answers than this, but here's one way to 
accomplish what you want.  First create an "invisible" surface (note 
that it is invisible in the same way that a polar bear is invisible 
during a blizzard: you can't see it because it blends in with its 

f[x_,t_]:=Exp[-(x-Cos[Pi t])^2]

PlotPoints->35,Boxed->False, Mesh->False, Shading->False];

If you want to check that it's really there, change the color of the 

PlotPoints->35,Boxed->False,Shading->False, Mesh->False, 

Now we create the curves you want.  We use Plot because it produces 
smoother curves than ParametricPlot3D; then we convert the curves to 
genuine 3D objects by first extracting the Line objects using Cases,
and  then applying a transformation rule to change the 2D-data into
3D.  The  z+epsilon is necessary to make sure none of the lines dip
below the  level of the surface.  You could use Mathematica to
calculate an  appropriate epsilon, or just use trial and error. 

                      Plot[f[x,t],{x,-5,5},DisplayFunction -> 
              _Line, Infinity]/.{x_Real, z_}:>{x,t,z+epsilon},
          {t, 0., 3, 3./34}];

Now show both graphics together:

Show[s, Graphics3D[gtab] ];

Of course, if you intended to use this kind of plot very often it would
 not be difficult to write a routine that would perform these steps
for  you.  Also note: you can color the surface any way you like (you
don't  have to make it match the background unless that is the effect
you're  looking for.)

Hope this helps,

Ron Goetz

-----Original Message-----
From: Marcia T. Fontenelle <> To:
Subject: [mg11711] [mg11632] Stack graphics

>I would like to plot a set of curves, say f[x,t], for several different
>t's, almost like a 3D plot, but with mesh just on t. More like
>StackGraphics does, but each curve should hide the ones on the back.
>Observe the following example and compare the two outputs
>f[x_,t_]:=Exp[-(x-Cos[Pi t])^2]
>** Here Mathematica draws a beautiful plot, with HiddenSurface->True,
>but the mesh is in both directions
>gtab=Table[Plot[f[x,t],{x,-5,5},DisplayFunction -> Identity], {t,
>** Here StackGraphics produces mesh just in t, as wanted, but I cannot
>set HiddenSurface->True. The result is not adequate for my problem.
>(Just imagine something a little more complicated than Gaussian packets
>oscillating forth and back in time-it would be certainly too hard to
>What would be the solution for this? Is there any option in Plot3D that
>I haven't seen yet?
>Best regards,
>Marcia T. Fontenelle
>Laser Physics and Quantum Optics
>KTH - Royal Institute of Technology
>10044 Stockholm

  • Prev by Date: Animation?
  • Next by Date: FixedPoint and SameTest
  • Prev by thread: Re: Stack graphics
  • Next by thread: Re: Stack graphics