# ListPlot in a Table with different colours and labels

I am making a Table of ListPlots, in which I superimpose two ListPlots with Show.

I would like to make each nth element of a different colour and with a diffenret label on the legend.

The line in the code is this:

plots =  Table[
Show[ListPlot[cumulativeMaximaOut[[n]][[1]]],
ListPlot[cumulativeMaximaOut[[n]][[2]]]], {n, 1, Length[xm]}]


Is it possible to make each nth element automatically of a different colour (and label), or do I have to define a string of labels and of colours before hand (of finite length then)?

I tried this:

plots =  Table[
ListPlot[{Labeled[cumulativeMaximaOut[[n]][[1]], "sqrt"],
Labeled[cumulativeMaximaOut[[n]][[2]], "log"]}], {n, 1,
Length[xm]}]


and it says:

Requested order is too high; order has been reduced to {2}

--

Data for cumulativeMaximaOut is here: http://pastebin.com/cb9i9FeP,

xm = {2,3,4}

• This may have something to do with the internal structure of your data. You need to provide some representative data for your cumulative... list, and xm. – MarcoB Nov 24 '16 at 19:17
• Do I just write down what values the arrays have? Is there a better way of providing data here? – SuperCiocia Nov 24 '16 at 19:21
• You can use e.g. pastebin to share larger amounts of data: paste the data there and then add a link to your original question. – MarcoB Nov 24 '16 at 19:22

I created some synthetic data that is the value of Sin from 0 to 2π with a variable frequency.

data = Table[{θ, Sin[n θ]}, {n, 1, 6}, {θ, 0, 2 π, 2 π/500}];


ListPlot itself can handle the this with multiple colors.

ListPlot[data]


You need to do something to handle the legends

ListPlot[
data,
PlotStyle -> PointSize[0.01],
PlotLegends -> Flatten@Table[
{"Sin[" ~~ ToString[n] ~~ " x]",
"Sin[" ~~ ToString[n + 1] ~~ " x]"},
{n, 1, Length[data] - 1, 2}
]
]


There are many approaches you can use to create the legends depending upon the character of your data.

I am not entirely sure that I understand your final desired formatting. However, here is an attempt at differentiating the two data series present in each component of your data set:

ListPlot[#,
PlotStyle -> {PointSize[0.03], PointSize[0.005]},
PlotLegends -> {"sqrt", "log"},
PlotRange -> {{-300, 6800}, {-3, 49}},
Axes -> False, Frame -> True,
ImageSize -> Medium
] & /@ cumulativeMaximaOut


• Oh yeah sorry I guess I was wrong in the code. I actually meant to plot all the three graphs on top of each other, each with a different colour and label. Do you have any idea on how to do that? – SuperCiocia Nov 24 '16 at 22:10