# Plot column 1 against list of columns in column 2 (ListPlot)

I want to generalize this plotting command:

Show[ListLinePlot[data1[[All, {1, #}]] & /@ columnlist]


which takes a table “data1”, defined as:

table1lines = RandomInteger[{3, 7}];
data1 = RandomReal[1, {table1lines, 5}]


(so I do not know the number of lines in advance) and plots graphs of all data from the first column against all data in columns given by “columnlist”, e.g.:

columnlist={2,3}


This works perfectly. Now I have a table data2 of a different structure, starting from the second column, each column consists of a list of real numbers (the same amount on each line), instead of just one number as before (actually I get it as a solution of Eigensystem):

dimension = RandomInteger[{3, 7}];
matrix = RandomReal[1, {dimension, dimension}]
data2=Re[Transpose[Eigensystem[N[matrix]]]]


so the second column, unlike the first one, in table "data2" is a list. I want to plot all data from the first column against all data on positions one to N from column 2 (so I will have N graphs in the plot). How to achieve this?

• @Kuba Sorry, I don't get it, could you please modify my example using your solution? – wondering Nov 29 '14 at 9:18
• @Kuba Data? As I wrote, we have a table "result", each row has the structure mentioned above, so sth. like: Table[{a[i], {b1[i], b2[i], b3[i]}}, {i, 1, imax}]. (And I don't know how big imax is.) – wondering Nov 29 '14 at 9:53
• @rhermans I changed the question, is this sufficient? – wondering Nov 29 '14 at 17:45

ListLinePlot@Table[
Transpose[{data2[[All, 2, k]], data2[[All, 1]]}]
, {k, Length[data2[[1, 2]]]}
]


or

ListLinePlot@Array[
Transpose[{data2[[All, 2, #]], data2[[All, 1]]}] &
, Length[data2[[1, 2]]]
]


I'm not sure if this is what you want but I used Thread to solve your problem:

dimension = RandomInteger[{3, 7}];
matrix = RandomReal[1, {dimension, dimension}];
data2 = Re[Transpose[Eigensystem[N[matrix]]]];
data2 // Grid


processedData = Thread /@ data2 // Transpose;
processedData // Grid


processedData // ListLinePlot


• That would work too, thanks! – wondering Nov 29 '14 at 19:54