Re: 2-d graphs to 3-d
- Subject: [mg2514] Re: 2-d graphs to 3-d
- From: ianc (Ian Collier)
- Date: Wed, 15 Nov 1995 07:01:32 GMT
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
- Sender: daemon at wri.com ( )
In article <DHv1wz.B2w at wri.com>, Mark Schunder <mschunde at umich.edu> wrote:
> Maybe you can help me out. I have a Mathematica question for
> you. I have generated 300 2-D graphs. Each of these graphs is
> made up of 256 different colors (not all of them have 256
> colors though). Is there a way to create a 3-D graph out of
> these by stacking them on top of each other? And possibly only
> showing a certain color? For instance I would like to 'graph'
> wherever the color .3,.2,.1 shows up (in RGB) in 3-D. I
> s this possible with Mathematica?
>
> Thanks
If I have understood y correctly you can do this using
ParametricPlot3D. ParametricPlot3D allows you to plot
multiple objects. It also allows you to plot lines in
space, you just have to set either x or y to be constant.
Finally you can use a 4th parameter for the colour of each
object.
Here is a simple example:
In[49]:=
expr1 = Sin[x]/x;
In[50]:=
Plot[ expr1, {x, -10,10} ]
Out[50]=
-Graphics-
In[51]:=
expr2 = Cos[x]/x;
In[52]:=
Plot[ expr2, {x, -10,10} ]
Out[52]=
-Graphics-
In[53]:=
expr3 = Cos[x];
In[54]:=
Plot[ Cos[x], {x, -10,10}]
Out[54]=
-Graphics-
In[55]:=
?ParametricPlot3D
ParametricPlot3D[{fx, fy, fz}, {t, tmin, tmax}] produces a
three-dimensional space curve parameterized by a variable
t which runs from tmin to tmax. ParametricPlot3D[{fx, fy,
fz}, {t, tmin, tmax}, {u, umin, umax}] produces a
three-dimensional surface parametrized by t and u.
ParametricPlot3D[{fx, fy, fz, s}, ...] shades the plot
according to the color specification s.
ParametricPlot3D[{{fx, fy, fz}, {gx, gy, gz}, ...}, ...]
plots several objects together.
In[56]:=
Needs[ "Graphics`Colors`"]
In[57]:=
ParametricPlot3D[ {{x,1, expr1, Red},
{x, 2, expr2, Green},
{x, 3,expr3, Blue}},
{x, -10,10}, BoxRatios -> {3,1,1}]
Out[57]=
-Graphics3D-
I hope this helps.
--Ian
-----------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
-----------------------------------------------------------
tel:(217)-398-0700 fax:(217)-398-0747 ianc at wri.com
Wolfram Research Home Page: http://www.wri.com/
-----------------------------------------------------------