# On multiple ListPlot

Suppose that I have a following data:

tab = {{1,2,-3,5}, {5,-2,3,1}, {2,0,4,5}};


I want to make a ListPlot based on tab as follows:

1. Focusing on the first and the second column, plot (1,2), (5,-2), (2,0).
2. Focusing on the first and the third column, plot (1,-3), (5,3), (2,4).
3. Focusing on the first and the last column, plot (1,5), (5,1), (2,5).

I want to make the colors in three groups 1., 2., and 3. different. How can I achieve this? (Of course, this is a simple example and my real data has a large number of points, but the number of column can be handled by hand.)

• You can access data by 1. tab[[All , {1, 2}]] , 2. tab[[All , {1, 3}]] 3. tab[[All , {1, -1}]]. If you plot them all together Mathematica will assign different colors, if not use PlotStyle. May 30 at 7:53
• @BenIzd This perfectly answers my question. Thank you so much! May 30 at 7:58
• @Nasser The questions is already answered, but my intention was that if there are $n$ columns, then the first and the $i$-th columns for each $2\leq i \leq n$ are used. In my application, $n=6$. May 30 at 7:59
• May 30 at 8:01
• @eigenvalue Your welcome. Also, remember for the last point, I use -1, which depends on the number of columns. May 30 at 8:02

Let's say your data looks like this

data = Transpose@Join[{0.1*Range[10]},Sort/@RandomReal[1,{10,10}]];
TableForm@data


You can ListPlot all columns except the first against the first column, without specifying the number of columns, like this

With[
{n=Length[First@data]},
ListLinePlot[
Table[
data[[All,{1,j}]]
,{j,2,n}
]
, PlotStyle  -> Array[Hue,n,{0,0.8}]
, PlotLegends-> Table[StringTemplate[" vs "][j,1],{j,2,n}]
]
]