2

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?

wondering
  • 595
  • 3
  • 18
  • @Kuba Sorry, I don't get it, could you please modify my example using your solution? – wondering Nov 29 '14 at 09: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 09:53
  • Please help us to help you and provide an actual example of your data in the question. – rhermans Nov 29 '14 at 11:14
  • @rhermans I changed the question, is this sufficient? – wondering Nov 29 '14 at 17:45

2 Answers2

4

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

Mathematica graphics

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

Mathematica graphics

processedData // ListLinePlot

Mathematica graphics

seismatica
  • 5,101
  • 1
  • 22
  • 33
3
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]]]
 ]
rhermans
  • 36,518
  • 4
  • 57
  • 149