Re: how to generate many plots without so many input lines?
- To: mathgroup at smc.vnet.net
- Subject: [mg9661] Re: how to generate many plots without so many input lines?
- From: "Xah" <xah at best.com>
- Date: Fri, 21 Nov 1997 01:30:59 -0500
- Organization: smtp.best.com
- Sender: owner-wri-mathgroup at wolfram.com
In article <64qr1s$jg9 at smc.vnet.net>, robpeterson at iname.com wrote:
>Re: how to generate many plots without so many input lines?
Here's the standard way to do it.
Clear[x,y]
x[u_,v_]:=(u+1+Exp[u]Cos[v])/Pi;
y[u_,v_]:=(v+ Exp[u] Sin[v])/Pi;
ParametricPlot[
Evaluate at Table[{x[u,v],y[u,v]},{v,-Pi,Pi,2*Pi/40}],{u,-2*Pi,Pi},
AspectRatio->Automatic,PlotRange->{{-1,1},{-1,1}}*3,
PlotStyle->Table[Hue[i],{i,0,1,1/39}]];
Basically, you generate a table of formulas and feed it to
ParametricPlot. The Evaluate in front of Table is necessary because
otherwise ParametricPlot will think that the Table[...] is the actual
formula you want to plot.
The above method depends on a special feature of Plot or ParametricPlot.
Namely, they can take a list of formulas. Another way to do what you
wanted, is using Map. This is more of a general technique in
Mathematica prograMing.
plots=(First at ParametricPlot[#,{u,-2*Pi,Pi},DisplayFunction->Identity]&)/@(
Table[{x[u,v],y[u,v]},{v,-Pi,Pi,2*Pi/40}]);
coloredPlots=Transpose at {Table[Hue[i],{i,0,1,1/(Length at plots-1)}],plots};
Show[Graphics[{coloredPlots}],AspectRatio->Automatic,
PlotRange->{{-1,1},{-1,1}}*3];
Xah, xah at best.com
http://www.best.com/~xah/Wallpaper_dir/c0_WallPaper.html
Mountain View, CA, USA