MathGroup Archive 2009

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

Search the Archive

Animate parametric plot of two lists?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101475] Animate parametric plot of two lists?
  • From: Porscha Louise McRobbie <pmcrobbi at umich.edu>
  • Date: Wed, 8 Jul 2009 07:11:05 -0400 (EDT)

Hello,

When I have explicit formulas for two functions of time, it's simple 
to animate the parametric plot of them by using ParametricPlot inside 
Animate.

I'd like to create a similar animation now, but using two lists of 
numbers. Apparently there is  no function such as ListParametricPlot.

Below a roundabout way I found (I want to show both a dashed line and 
a point tracing out the curve in time). Is there a better way to do 
this? I'd like to be able to include many more frames, and this method 
seems inefficient.

Any suggestion/help is appreciated.

Porscha



(*Animate a parametric plot from two lists*)
In[1]:= f[t_] := Cos[t]
In[2]:= g[t_] := Sin[t]

In[27]:= list1 = Table[f[t], {t, 0, 2 Pi, .1}];
In[28]:= list2 = Table[g[t], {t, 0, 2 Pi, .1}];

In[29]:= n = Length[list1];
In[30]:= plotdat = Thread[{list1, list2}];
In[31]:= frame = ConstantArray[0.0, n];

In[32]:= Do[
  frame[[j]] =
   Show[ListLinePlot[plotdat[[1 ;; j]], PlotStyle -> {Red, Dashed},
     PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}}],
    ListPlot[plotdat[[1 ;; j]],
     PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
     PlotMarkers -> {Automatic, 12}]], {j, 1, n}]

In[33]:= ListAnimate[frame]



  • Prev by Date: Re: put some elements to zero
  • Next by Date: Re: Jens-Peer Kuska passed away
  • Previous by thread: Re: Re: including specific values in
  • Next by thread: Re: Animate parametric plot of two lists?