Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Q: How to animate a list plot?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69558] Re: [mg69500] Q: How to animate a list plot?
  • From: János <janos.lobb at yale.edu>
  • Date: Fri, 15 Sep 2006 06:46:05 -0400 (EDT)
  • References: <200609141055.GAA21519@smc.vnet.net>

On Sep 13, 2006, at 4:09 PM, Coleman, Mark wrote:

> Greetings,
>
> I'm trying to figure out how to develop -- for lack of a better  
> term --
> an animated scatter plot. I have three variables, call them x, y,  
> and z.
> The points x and y are recorded measurements on the same subjects,  
> taken
> at different points in time. The variable z does not change over time.
>
> I'd like to find a way to visualize how the ListPlot[{x,z}]  
> transitions
> into the ListPlot[{y,z}]. My sample of data is 250 points, so I am
> trying to visualize 250 points moving from one set of positions on the
> Cartesian plane to another set of positions. The y observations are  
> more
> highly correlated with z, so one could image the points becoming more
> tightly clustered as one moves from x->y. Any thoughts on how I might
> show this?
>
> Thanks,
>
> -Mark


My newbie approach to it would be to create a Table of ListPlots,  
collapse them and then double click on them.  That would show a nice  
animation.  Another approach might be to create a GraphicsArray and  
play it with Show.

Here is an example showing both.  I am displaying the #30 cell  
automata with some additional ListPlots.  After the big Table command  
is done - that might take some minutes - you can collapse the  
individual plots displayed and after it double-clicking on it you can  
see an animation of all on the row.

In[15]:=
k = 2
r = 1
steps = 100

In[18]:=
Off[General::Spell];
Off[General::Spell1];

In[20]:=
<< "DiscreteMath`GraphPlot`";

In[21]:=
ca30 = Table[
     CellularAutomaton[
      {30, k, r}, Join[
       Table[0, {l, 1, i}],
       {1}, Table[0, {l, 1,
         steps - i}]], steps],
     {i, 0, steps}];

In[22]:=
lp30 = Table[
     (N[Log[FromDigits[
          Reverse[
           #1]]]] & ) /@
      ca30[[i]], {i, 1, 100}];

In[23]:=
tp30 = Table[
     (N[Log[FromDigits[
          Reverse[
           #1]]]] & ) /@
      Transpose[ca30[[i]]],
     {i, 1, 100}];

In[24]:=
tl30 = Table[Thread[
      {lp30[[i]], tp30[[i]]}],
     {i, 1, 100}];

In[25]:=
tlgp30 = Table[
     (#1[[1]] -> #1[[
         2]] & ) /@ Partition[
       tl30[[i]], 2, 1],
     {i, 1, 100}];

Here comes the big Table:

In[26]:=
Table[Show[GraphicsArray[
      {ArrayPlot[ca30[[i]],
        DisplayFunction ->
         Identity], ListPlot[
        lp30[[i]],
        DisplayFunction ->
         Identity,
        AspectRatio -> 1,
        PlotRange -> All],
       ListPlot[tp30[[i]],
        DisplayFunction ->
         Identity,
        AspectRatio -> 1,
        PlotRange -> All],
       ListPlot[tl30[[i]],
        DisplayFunction ->
         Identity,
        AspectRatio -> 1,
        PlotRange -> All],
       GraphPlot[tlgp30[[i]],
        Method ->
         SpringElectricalModel\
, DisplayFunction ->
         Identity]}],
     DisplayFunction ->
      $DisplayFunction,
     PlotLabel -> {i}],
    {i, 1, 100}];

If you want to listen to it not just watch, then:

In[27]:=
(ListPlay[#1] & ) /@ lp30

(ListPlay[#1] & ) /@ tp30

etc....

János

P.S.  If you want to see funny things than watch the 5th column for  
CA #3, CA #9, CA #11, CA #102  or for CA #110 :)

--------------------------------------------
f @@ # & /@ ===  f @@@


  • Prev by Date: Re: (again) common problem with FindMinimum and NIntegrate
  • Next by Date: RE: Re: Re: Re: solve and Abs
  • Previous by thread: Q: How to animate a list plot?
  • Next by thread: Re: Q: How to animate a list plot?