MathGroup Archive 2005

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

Search the Archive

Re: "layering" 2d plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60591] Re: [mg60568] "layering" 2d plots
  • From: Jeff Bryant <jeffb at wolfram.com>
  • Date: Wed, 21 Sep 2005 03:20:29 -0400 (EDT)
  • References: <200507030757.DAA18308@smc.vnet.net> <200507040624.CAA05801@smc.vnet.net> <200509200920.FAA17937@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

   There is no general way to do this for all 2D plots.  For things like 
ListDensityPlot and ArrayPlot, the result is a raster, or an array of 
colors.  There is no sense of a 3D raster.  To do what you want with a 
raster type image, you will need to convert the array of data into a set 
of 3D polygons with the correct color.  The following code is kind of 
quick and dirty and there may be better ways to do this, but it seems to 
work well enough to get you started.  This one uses the same type of 
data used by ListDensityPlot and ArrayPlot:

In[1]:= With[{t=0},
    dat=Table[Sin[x-t]+Cos[y-t],{x,0,4 Pi,.1},{y,0,4 Pi,.1}]];

Now, we convert the colors in the array to 3D four-sided polygons in the 
z=0 plane.

In[2]:=
gr1=MapIndexed[List,dat/.x_?NumberQ->GrayLevel[x],{
               2},Heads->False]/.{
             GrayLevel[gl_],{x_,y_}}->{EdgeForm[],SurfaceColor[
           GrayLevel[Rescale[gl,{
       Min[Flatten[dat]],Max[Flatten[dat]]}]]],Polygon[{{x,y,0},{x+1,
         y,0},{x+1,y+1,0},{x,y+1,0},{x,y,0}}]};

In[3]:= Show[Graphics3D[gr1]]

You can do a similar operation for your various "slices", just make sure 
that you use a different z value for the polygons so they don't end up 
in the same plane as another "slice".

Good luck!
-Jeff

Curtis Osterhoudt wrote:
> Hi, all, 
> 
>     I have a question about the ability to show 2D graphics in a pseudo
> 3D way.
> 
>     I have produced a series of 2D plots, each of some system with some
> parameter changed slightly (this is experimental data. To forestall
> questions along the lines of "why don't you sample the function in a
> different way", I'll say that it's not possible yet. In addition, it'd
> just be nice to see if this -- proposed --  way is possible in
> practice). Although making an animation with the plots one after another
> is possible, I think it'd be a bit easier to see what's going on if I
> could "stack" each plot on top of the others, but with perspective shown.
> 
>     *     Can I take a 2D plot, either an imported picture or a
>       Mathematica ArrayPlot or something similar, and show it in "3D",
>       in which the plot looks like a sheet of paper viewed from some
>       oblique angle, foreshortened appropriately?  I think this is the
>       sticking point of the whole exercise.
>     *     If the answer to the previous question is "yes", then how
>       would I stack several of these atop each other, so that trends
>       along the "stack axis" become apparent? Of course, some space
>       between each "sheet" would have to be given, so that the viewer
>       can look at (most of, depending on degree of overlap of the sheets
>       and viewpoint) each 2D dataset.
>     *     Do others have need of a similar method of viewing data?
>       Should I submit a request for such an ability to Wolfram?
>     *     Are there (hopefully opensource like gnuplot, but, e.g. Origin
>       is an acceptable answer) plotting routines which already do what
>       I'm trying to achieve?
> 
>  
>            Regards, and thanks,
>                      Curtis O.
> 


  • Prev by Date: Re: Re: another Bug in Reduce ?
  • Next by Date: Re: Set of strings reducing problem (Again!)
  • Previous by thread: Re: "layering" 2d plots
  • Next by thread: Re: "layering" 2d plots