matlab like multiline plot in Mathematica

So I have a matrix of values were the rows correspond to sets of data, and I want to plot each of these using ListPlot but I want to have a different x-axis than the index. In matlab I would have:

x = 0:4;

ys = [10 20 40 80 160; 
      20 40 80 160 320; 
      30 60 120 240 480]';

plot(x,ys)

and this would give three lines with x-values 0-4 and the y-values being each column.

The closest I could come up with in Mathematica is

x = Range[0,4];

ys = {{10, 20, 40, 80, 160},
      {20, 40, 80, 160, 320},
      {30, 60, 120, 240, 480}};

ListPlot[Transpose[{x,#}]& /@ ys]

Mathematica graphics

Is this the correct way? It seems a bit cryptic. Hoping there is a function or option I am missing.

5
задан Sjoerd C. de Vries 3 January 2012 в 22:01
поделиться