Re: how to generate many plots without so many input lines?
- To: mathgroup at smc.vnet.net
- Subject: [mg9679] Re: [mg9651] how to generate many plots without so many input lines?
- From: Hugh Walker <hwalker at hypercon.com>
- Date: Fri, 21 Nov 1997 01:31:16 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Rob Peterson robpeterson at iname.com wrote: >The following code nicely plots a bunch of curves on one plot. > >*************************************** >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]; > ......... >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? Hello Rob: I think the following code does what you want. x[u_,v_]:=(u+1+Exp[u]Cos[v])/Pi; y[u_,v_]:=(v+ Exp[u] Sin[v])/Pi; v = Table[q,{q,-Pi,Pi,Pi/8}]; plots = Map[ParametricPlot[{x[u,#],y[u,#]},{u,-2Pi,Pi}, AspectRatio->Automatic,DisplayFunction->Identity]&,v]; Show[plots,DisplayFunction->$DisplayFunction]; Cheers! Hugh Walker Gnarly Oaks