# sequential execution of Show with two input streams, one of graphics object and another of characters

The question is how to sequentially execute Show with two streams of input. The first is graphics object stream and the second is a character stream for supplying labelling for the graphics. I tried

ss={{ListPlot[x1]},{ListPlot[x2],...};labelling={aa,bb,cc,dd....};
Map[Show[#1,PlotLabel->StringJoin[#2,"...","..."]]&,{ss,labelling}]

• I tried both Map and MapThread to inconsistent results. It became consistent when I put the labelling elements into individual curly brackets, i.e., labelling={{aa},{bb},{cc},(dd)) Wonder why is this the case? – Z Ming Ma Jun 13 at 0:23

You can use MapThread:

SeedRandom[1]
{x1, x2, x3, x4} = RandomInteger[100, {4, 30}];

ss = ListPlot /@ {x1, x2, x3, x4};

labeling = {"aa", "bb", "cc", "dd"};

MapThread[Show[#, PlotLabel -> StringJoin[#2, "...", "..."]] &, {ss, labeling}]


Alternatively, you can Apply the function Show[...] on Transpose[{ss, labeling}]:

Show[#1, PlotLabel -> StringJoin[#2, "...", "..."]] & @@@ Transpose[{ss, labeling}]


same picture

You can also use ListPlot[...] in the first argument of MapThread:

datasets = {x1, x2, x3, x4};
colors = {Red, Green, Blue, Orange};
joined = {True, False, False, True};

PlotLabel -> StringJoin[#2, "...", "..."], PlotStyle -> #3] &,
{datasets, labeling, colors, joined}]


Again, you can Apply the function ListPlot[...] on tuples of parameters to get the same result:

ListPlot[#, Joined -> #4,
PlotLabel -> StringJoin[#2, "...", "..."], PlotStyle -> #3] & @@@
Transpose[{datasets, labeling, colors, joined}]


same picture

• I tried both Map and MapThread to inconsistent results. It became consistent when I put the labelling elements into individual curly brackets, i.e., labelling={{aa},{bb},{cc},(dd)) Wonder why is this the case? – Z Ming Ma Jun 13 at 0:22