# Plot in a loop?

I have a list of objects, which I can plot manually:

one   = MapThread[{#, 1 #}&, {Range[0, 5]}];
two   = MapThread[{#, 2 #}&, {Range[0, 5]}];
three = MapThread[{#, 3 #}&, {Range[0, 5]}];

ListLinePlot[
{
Legended[ Symbol["one"],   "one"   ],
Legended[ Symbol["two"],   "two"   ],
Legended[ Symbol["three"], "three" ]
}
]


I'm looking for a way to plot the same in a loop:

ListLinePlot[
MapThread[Legended[ Symbol[#], # ]&, {"one", "two", "three"}]
]


However, this does not work.

• Just use Map instead of MapThread.: ListLinePlot[Map[Legended[Symbol[#], #] &, {"one", "two", "three"}]]. – Henrik Schumacher Oct 25 '18 at 6:25
• Btw., Map also suffices for constructing the data: one = Map[{#, 1 #} &, Range[0, 5]]; two = Map[{#, 2 #} &, Range[0, 5]]; three = Map[{#, 3 #} &, Range[0, 5]];. – Henrik Schumacher Oct 25 '18 at 6:26
• @HenrikSchumacher: Indeed! – Adobe Oct 25 '18 at 6:30
• @HenrikSchumacher, can you make it an answer so I can accept it? – Adobe Oct 25 '18 at 7:43

Turning a comment into an answer.

Just use Map instead of MapThread:

ListLinePlot[Map[Legended[Symbol[#], #] &, {"one", "two", "three"}]]


Indeed, Map also suffices for constructing the data:

one = Map[{#, 1 #} &, Range[0, 5]];
two = Map[{#, 2 #} &, Range[0, 5]];
three = Map[{#, 3 #} &, Range[0, 5]];


MapThread is meant only for functions in several variables that are supposed to be fed from arguments stored in several lists. Of course, you can also use MapThread, but you would have to add another pair of braces in order to match MapThread's syntax:

ListLinePlot[MapThread[Legended[Symbol[#], #] &, {{"one", "two", "three"}}]]


data = Table[{#, i #} & /@ Range[0, 5], {i, 3}];

• The data points in the question are not real. The real ones are much more complex. The crucial thing remains the same: to generate Legended invocations. PlotLegends are much more complex as well (involving string interpolation). – Adobe Oct 25 '18 at 6:17