3
$\begingroup$

Suppose have data for several x and several y(x), for example

mydata = {{11, 1.1, 2.3, 2.4}, {12, 1.3, 1.4, 1.9}, {13, 1.8, 1.7, 1.2}}
mydata // MatrixForm

So

for x=11, have y(x)= 1.1, 2.3 and 2.4

for x=12, have y(x)= 1.3, 1.4 and 1.9

for x=13, have y(x)= 1.8, 1.7 and 1.2

How to do list plot for many y(x) as function of x?

Use of

ListPlot[mydata]

is no working.

$\endgroup$
1

3 Answers 3

4
$\begingroup$
mydata2 = Thread[{First@#, Rest@#}] & /@ mydata;
ListPlot[mydata2]

enter image description here

$\endgroup$
4
$\begingroup$
mydata2 = Map[(mydata[[All, {1, #}]]) &, Range[2, Last@Dimensions@mydata]];
ListPlot[mydata2, Joined -> True]

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Notice how your image is very similar to Mr.Wizard's image. Still, you image somehow appears to be of lower visual quality; it looks 'fuzzy' or something. Why is that? Well, this is because you saved it as a JPG image. JPG works well with photographic images, but introduces artefacts in illustrations, diagrams, screenshots, etc. For this kind of images, PNG is the ideal choice! :) $\endgroup$ Commented Jan 11, 2019 at 13:11
2
$\begingroup$

Not applicable to all data, but in this case DataRange appears useful:

ListLinePlot[mydata\[Transpose][[2 ;;]], DataRange -> {11, 13}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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