# ListPlotting data from a table [closed]

A very simple question. I have a data table with three columns. how can i plot column 1 vs column 3 using ListPlot?

thx in advance

-
 – image_doctor Jan 22 at 13:25 my list looks like this t={{14., 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.}, {14., 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.}, {16., 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9, 17.}}. ListPlot[{t[[1]],[[3]]}] doesnt gives me column1Vscolumn3 ! :/ – Darwin Jan 22 at 13:35 Take a look at Transpose. – Andy Ross Jan 22 at 13:45 You need {t[[1]], t[[3]]} to take the first and third element. From this (see @AndyRoss), you'll need to make the pairs (x,y) to be plotted. – b.gatessucks Jan 22 at 13:46 Help can be found here – cormullion Jan 22 at 13:50
show 1 more comment

## closed as too localized by Ajasja, Yves Klett, Szabolcs, Sjoerd C. de Vries, ArtesJan 22 at 17:33

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

## 2 Answers

The usual way to convert two sets of coordinates into one set of coordinate pairs in Mathematica is to use Transpose:

x = Range[10]
y = Range[1,20,2]

pairs = Transpose[{x,y}]


This might not feel intuitive if you are new to Mathematica.

For your data you could use either

ListPlot[Transpose[t][[All, {1,3}]]]


or

ListPlot[Transpose[ t[[{1,3}]] ]]

-
 thanks belisarius and Szabolcs your suggestions worked for me – Darwin Jan 23 at 9:24

The meaning of "vs" in your question has two possible interpretations:

t = {{14., 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9, 15.},
{14., 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7, 14.8, 14.9,  15.},
{16., 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8, 16.9,  17.}};

ListLinePlot[Transpose[t][[{1, 3}]], AxesOrigin -> {0, 13}]


Or:

ListLinePlot@Transpose[Transpose[t][[{1, 3}]]]


-
 i mean column1 being the x-axis and column3 being the y axis – Darwin Jan 22 at 15:38 @Darwin That is the second plot in my answer – belisarius Jan 22 at 16:29