MathGroup Archive 1999

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

Search the Archive

Re: animated, variable color lines in ListPlot

  • To: mathgroup at
  • Subject: [mg15645] Re: [mg15594] animated, variable color lines in ListPlot
  • From: BobHanlon at
  • Date: Sat, 30 Jan 1999 04:28:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 1/28/99 5:46:14 AM, poppa at writes:

>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.
>Thanks for any ideas on how to do this.


I did this with Plot but converting to ListPlot should be easy.  I also
did not bother to set up the y-Range (yRng) automatically.  In any
event, this should give you an idea of how to approach it.

multiPlot[func_, {x_, xmin_, xmax_}, 
	n_Integer /; n > 1, yRng_] := 
		Module[{k, j, plt, step = (xmax-xmin)/n}, 
			Table[plt[k] = Plot[func, 
					{x, xmin+(k-1)*step, xmin + k*step}, 
					DisplayFunction -> Identity, 
					PlotStyle -> Hue[k/n], 
						PlotRange -> {{xmin, xmax}, yRng}], {k, n}];
				Table[(Show[Table[plt[j], {j, k}], 
							DisplayFunction -> $DisplayFunction];), {k, n}]];

multiPlot[Sin[x], {x, 0, 2Pi}, 10, {-1, 1}]

Bob Hanlon

  • Prev by Date: Re: question
  • Next by Date: Re: Next Version of Mathematica?
  • Previous by thread: RE: animated, variable color lines in ListPlot
  • Next by thread: Re: animated, variable color lines in ListPlot