Re: how to generate many plots without so many input lines?
- To: mathgroup at smc.vnet.net
- Subject: [mg9684] Re: [mg9651] how to generate many plots without so many input lines?
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Fri, 21 Nov 1997 01:31:21 -0500
- Sender: owner-wri-mathgroup at wolfram.com
robpeterson at iname.com [mg9651] how to generate many plots without so many input lines? > The following code nicely plots a bunch of curves on one plot .... > Can someone tell me whether each plot must be generated on a > separate line? [full posting below line ***** ] Rob: If you just want to get your final plot then: ParametricPlot[ (*make a list of the expressions to be plotted. Evaluate is essential so that this is done before Plot starts*) Evaluate[{x[u, #1], y[u, #1]}&/@ {Pi,Pi/1.2,Pi/1.5,Pi/2,Pi/4,-Pi/4,-Pi/2,-Pi} ], {u, -2Pi, Pi}, AspectRatio -> Automatic ] Allan Hayes hay at haystack.demon.co.uk http://www.haystack.demon.co.uk/training.html voice:+44 (0)116 2714198 fax: +44 (0)116 2718642 Leicester, UK *************************************** x[u_,v_]:=(u+1+Exp[u] Cos[v])/Pi; y[u_,v_]:=(v+ Exp[u] Sin[v])/Pi; (* here are the equipotential surfaces *) v=Pi; a=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=Pi/1.2; b=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=Pi/1.5; c=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=Pi/2; d=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=Pi/4; e=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=-Pi/4; f=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=-Pi/2; g=ParametricPlot[{x[u,v],y[u,v]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]; v=-Pi; h=ParametricPlot[{x[u,v],y[u,v]},{u,-Pi,Pi},AspectRatio->Automatic, DisplayFunction->Identity]; Show[{a,b,c,d,e,f,g,h}, DisplayFunction->$DisplayFunction] ***************************************** Surely there is a way to generate the list {a,b,c,d,e,f,g,h} more easily/elegantly. Here's what I tried: {a,b,c,d,e,f}= ParametricPlot[{x[u,v],y[u,v]},{u,-Pi,Pi},AspectRatio->Automatic, DisplayFunction->Identity] /. v->{Pi/1.2,Pi/1.5,Pi/2,Pi/4,Pi/8,Pi/16} This doesn't work at all. I get all kinds of error messages I don't understand. Can someone tell me whether each plot must be generated on a separate line? Thanks for any clues, Rob