Re: ListLinePlot[] inside a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg82412] Re: ListLinePlot[] inside a loop
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 19 Oct 2007 05:08:38 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ff789h$nrs$1@smc.vnet.net>
Luiz Melo wrote:
> Why is the plot of a list not displayed when ListLinePlot[] is used inside a Do
> loop (Mathematica 6.0)?
> For instance, suppose we want to produce the graphics of Sin[i*x] as a function
> of x, each time i is iterated from 1 to 3 (in steps of 1). I naively tryed:
>
> Do[ListLinePlot[Table[{x, Sin[i*x Degree]}, {x, 0, 360}],
> PlotRange -> {{0, 360}, {-1.1, 1.1}}], {i, 1, 3}];
>
> The specifications "For[]" and "While[]" don't work either.
Since version 6.0, one must enclose the plot command within a *Print*
function when use the plot is part of a looping construct. The following
will display three graphs.
Do[Print[ListLinePlot[Table[{x, Sin[i*x Degree]}, {x, 0, 360}],
PlotRange -> {{0, 360}, {-1.1, 1.1}}]], {i, 1, 3}];
Regards,
--
Jean-Marc