Re: animated, variable color lines in ListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg15645] Re: [mg15594] animated, variable color lines in ListPlot
- From: BobHanlon at aol.com
- Date: Sat, 30 Jan 1999 04:28:41 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 1/28/99 5:46:14 AM, poppa at ix.netcom.com 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.
>
Dick,
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