2
$\begingroup$

Consider we have a table table1 with $n$ columns. I want to ListPlot two given columns from the table.

For example

table1 = RandomReal[1, {10, 5}]
$\endgroup$
1
$\begingroup$

Let's assume this is your data

data = RandomReal[1, {10, 5}]

Mathematica graphics

You may want to plot column $5$ vs $3$.

ListPlot[data[[All, {3, 5}]]]

Mathematica graphics

Or you may want to plot them independently

ListPlot[
 Transpose@data[[All, {3, 5}]]
 , Joined -> True
 ]

Mathematica graphics

Or more general, choose any pair, vs or independently, using Manipuate

Manipulate[
 ListPlot[
  If[vs, Identity, Transpose]@data[[All, {j, k}]]
  , Joined -> ! vs
  ]
 , {{j, 2}, Range[5], SetterBar}
 , {{k, 4}, Range[5], SetterBar}
 , {vs, {True, False}}
 ]

enter image description here

$\endgroup$
0
$\begingroup$
{{a, b, c}, {d, e, f}, {g, h, i}}[[All, 2 ;; 3]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.