MathGroup Archive 1999

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

Search the Archive

Re: animated, variable color lines in ListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15653] Re: animated, variable color lines in ListPlot
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Sat, 30 Jan 1999 04:28:48 -0500 (EST)
  • Organization: University of Western Australia
  • References: <78pc1u$d17@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Dick Phillips wrote:

> I'm trying to do an animation of the progressive development of a curve
> in ListPlot, where the color of a just-revealed segment of the curve is
> different from the previously-displayed segment. That is, at the end of
> the animation, the complete curve will be multi-colored. It's easy to
> change the color of the ENTIRE cuve at each time step, but I need to
> show the color evolution.

I think what you really want to do is not possible using the current
front end since it does not support real-time graphics.  However, here
is one (clumsy) way of faking it:

  data = Table[{x, Sin[Pi x]}, {x, 0, 4, 0.2}];

  grs = Table[Graphics[
          {Hue[i/Length[data]], Line[data[[Range[i, i + 1]]]]}], 
        {i, Length[data] - 1}];

  Table[Show[grs[[Range[i]]], PlotRange -> {{0, 4}, {-1, 1}}], 
    {i, Length[data] - 1}];

I've used Line primitives rather than ListPlot because it is slightly
easier to code.  The code could be improved using FoldList.

Cheers,
	Paul

____________________________________________________________________ 
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia            Nedlands WA  6907       
mailto:paul at physics.uwa.edu.au  AUSTRALIA                       
http://www.physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________


  • Prev by Date: Re: animated, variable color lines in ListPlot
  • Next by Date: Re: question
  • Previous by thread: Re: animated, variable color lines in ListPlot
  • Next by thread: Dividing top and bottom