# DataRange problem in a ListLinePlot within a Manipulate

I'm trying to create a simulation of a set of lists with Manipulate[] and ListLinePlot[]. However, as my simulation starts with the $x$-axis pre-defined (DataRange -> {1, 500}), the lists behave strangely, i.e., they are not plotted as intended. The lists do not obbey the $x$-axis (which is correctly plotted), but instead of that they are always at the right edge of the plot.

My code is:

randomWalk[x_]:=Accumulate[Prepend[RandomVariate[NormalDistribution[0, 1], x], 0]]
exchange=Table[Subscript[asset, i] = randomWalk[500], {i, 1, 5}];
Manipulate[ListLinePlot[exchange[[All, 1 ;; n]], DataRange -> {1, 500}], {n, 3,500, 1}]

Could someone give me a hint to solve this problem?

-
Perhaps you mean to use PlotRange instead. Try replacing your DataRange->{1,500} with PlotRange -> {{1, 500}, {-40, 40}}. –  Andy Ross Apr 9 '13 at 0:29
Yay! This works perfectly! Thanks! –  Rod Apr 9 '13 at 0:30

## 1 Answer

What you want here is PlotRange. The following does what you intend.

randomWalk[x_] := Accumulate[Prepend[RandomVariate[NormalDistribution[0, 1], x], 0]]
exchange = Table[Subscript[asset, i] = randomWalk[500], {i, 1, 5}];
Manipulate[ListLinePlot[exchange[[All, 1 ;; n]],
PlotRange -> {{1, 500}, {-40, 40}}]
, {n, 3, 500, 1}]

-
The only thing I would change now is to put the $y$-axis at the left side of the plot and use PlotRange -> {{1, 500}, {Min[exchange], Max[exchange]}}. Anyway, thanks a lot !! –  Rod Apr 9 '13 at 0:36
To put the y-axis on the left you can fix it with AxesOrigin->{1,0}. –  Andy Ross Apr 9 '13 at 0:39
I've done that too! Thanks again! –  Rod Apr 9 '13 at 0:42