# Plotting 4 separate lines on a graph

I want to plot 4 separate lines on my graph but for some reason Mathematica is linking all my points into a single lines.

My data:

v = {3.26797, 4.07436, 5.12821, 5.42005};
m = {0.004, 0.00592, 0.00836, 0.01060};


I want a straight line from the origin {0,0} to the point {0.004,3.26797}, {0,0} to the point {0.00592,4.07436}, ..., {0,0} to the point {m[[4]], v[[4]]}.

I tried the code:

ListLinePlot[{{0.004, 10.6797}, {0.00592, 16.6004}, {0.00836, 26.2985},
{0.01060, 29.3769}}]


but all I am getting is a single line.

v = {3.26797, 4.07436, 5.12821, 5.42005};
m = {0.004, 0.00592,0.00836, 0.01060};

ListLinePlot[Table[{{0, 0}, {m[[i]], v[[i]]}}, {i, 1, 4}],Frame -> True]


• Hi Hubble, how would I label each lines? You don't necessarily have to give me the code (although you could and I would study them). Pointing me to a right direction is good (: – boyinneed Mar 18 '15 at 12:50
• The easiest way is to use PlotLegend. reference.wolfram.com/language/PlotLegends/ref/PlotLegend.html – Hubble07 Mar 18 '15 at 12:55
• I did it =p Thank you! And if I would like to label both axes, it's with the function AxesLabel? – boyinneed Mar 18 '15 at 13:01
• I made an edit. – boyinneed Mar 18 '15 at 13:09
v = {3.26797, 4.07436, 5.12821, 5.42005};
m = {0.004, 0.00592, 0.00836, 0.01060};

ListLinePlot[{{0, 0}, #} & /@ Transpose[{m, v}]]


I think I'd use MapThread here, instead of either Table or Map plus Transpose. Table has two disadvantages: each element must be accessed by index and the length of the data must be determined. Map, on the other hand, cannot do the job by itself and requires Transpose or Thread. None are great tasks, but represent extra work. MapThread is conceptually simpler:

MapThread[{{0, 0}, {##}}&, {m, v}]
(*
{{{0, 0}, {0.004, 3.26797}}, {{0, 0}, {0.00592, 4.07436}},
{{0, 0}, {0.00836, 5.12821}}, {{0, 0}, {0.0106, 5.42005}}}
*)


That said, Table is the simplest if the data sets are of unequal length:

Table[{{0,0}, {m[[i]], v[[i]]}}, {i, Min[Length /@ {m,v}]}]