2
$\begingroup$

Can ListLinePlot be used as the following?:

ListlinePlot[{x1,y1,y2,y3},{x2,y4,y5,y6...}]

My goal is to plot with co-ordinates having three values of y for each value of the independent variable x.

How would I write the code to do so?

$\endgroup$

2 Answers 2

4
$\begingroup$
SeedRandom[1234]

data = RandomReal[1, {5, 4}] // Sort

(* {{0.0116446, 0.927266, 0.543757, 0.479332}, {0.245349, 0.759896, 
  0.984993, 0.217045}, {0.459017, 0.884729, 0.583854, 
  0.263973}, {0.876608, 0.521964, 0.0862234, 0.377913}, {0.91956, 
  0.423835, 0.98729, 0.587943}} *)

ListLinePlot[Transpose[Thread[{First[#], Rest[#]}] & /@ data],
 PlotLegends -> Automatic]

enter image description here

$\endgroup$
1
$\begingroup$

Using Bob Hanlon's example:

SeedRandom[1234]

data = RandomReal[1, {5, 4}] // Sort;

You can also use TemporalData as follows:

td = TemporalData[Rest /@ data, {First /@ data}];

ListLinePlot[td]

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.