# Creating and plotting multiple lists

• Oct 9th 2008, 12:15 PM
jnwebb
Creating and plotting multiple lists
I have a list of length N. I would now like to create N lists. Each of these lists will be the Y coordinate of a plot. Something like the following:

Code:

```For[p=1,p<=N,p++, Y[p] = Table[0, {i, ndof/2}];         x = 1; j = 1; t = 2;         For[i = 1, i <= Length[Y[1]], i++,                 If[DOFSupports[[j]] == x,                       Y[p][[i]] = 0; j = j + 1,                       Y[p][[i]] = \[Phi][[sigmodes[[1]], t]]; t = t + 3];         x = x + 2]```
The problem is Y[p][[i]] will not work.

Also, I would then like to plot each Y[p] with a loop that would plot each:

Code:

```ListLinePlot[{Y}, DataRange -> {0, X[[ndof/2]]},  PlotRange -> {-0.8, 0.8}]```
Any help would be appreciated. I am sure it will have something to do w/ setting up functions...which I haven't quite grasped well yet. Thank you.
• Oct 9th 2008, 03:34 PM
shawsend
I don't quite follow your code. However, why not just set up a double array with the list of points for each plot as the columns and the rows, the plots. Also, a double array is specified as a[[i,k]]. Maybe that would help you. Here's some example. The datapoint array gives the number of points for each plot. I next just generate some straight line data "xn" for each plot having the number of data points specified by the array datapoints. I then send that matrix to ListLinePlot. For example list[[2,3]]=4.

Code:

```datapoints = {5, 8, 9, 10, 15}; list = Table[x n, {n, 1, 5}, {x, 0, datapoints[[n]]}] ListLinePlot [list]```