Apply different colours to different ListPlots?

Hi,

I have not been able to figure out how to apply different colours to different ListPlots in a Show command. Specifically, how do I color one of the datasets in:

Show[ListPlot[data2], ListPlot[data], PlotRange -> All]

Specifying, e.g., PlotTheme → “Web” at the end causes both plots to go red; putting PlotTheme → “Web” after first ListPlot causes error message.

Any help will be greatly appreciated.

Strange

Depending what data and data2 are, you can simply do:

ListPlot[{data2,data}]

Hi Sander,

I think you missed my point. I want to color one dataset red, while the other remains black.

And I still do not know how to accomplish this.

Strange

Try opening the documentation…

ListPlot[{data2,data},PlotStyle->{Red,Black}]

Hi Sander,

Thanks very much for your recommendation to read the Documentation. That never occurred to me!

However, your suggestion does not seem to work. The statement

Show[ListPlot[data2], ListPlot[data], PlotRange → All, PlotStyle → {Red, Black}]

still results in both datasets being plotted in Black.

Thanks anyway.

Strange

PlotStyle is a ListPlot option. As I said before:

ListPlot[{data2,data},PlotStyle->{Red,Black}]

Alternatively, if you really want to use Show for some reason:

Show[ListPlot[data2,PlotStyle->Red], ListPlot[data,PlotStyle->Black], PlotRange -> All]

Hi again Sander,

I am sorry to say that your statement plots only data2 (albeit in red), but not data.

Perhaps this problem is harder to resolve than we think.

Strange

Then there is probably something ‘different’ (wrong?) with your data and data2:

data = Range[10]
data2 = 12 - Range[12]
ListPlot[{data, data2}, PlotStyle -> {Red, Blue}]

as you can see, this works perfectly fine. What are data and data2?

What is data and data2? Both of Sander’s suggestions should have worked fine.

Hi Robert and Sander,

These are the datasets:

data = List[{{5.44, 1.}, {13.44, 1.31351}, {21.44, 1.74846}, {29.44,
1.83433}, {37.44, 2.06847}, {53.44, 2.36553}, {77.44, 2.53351}}]

and

data2 = List[{d * p, y110}, {(1 + d) * p, y210}],

where d = 0.68 and p = 8.

They plot nicely (in Black) from

Show[ListPlot[data2], ListPlot[data], PlotRange → All]

Strange

Which version are you using? I can’t remember the default color to be black! Should be blue-ish…

data = {{5.44, 1.}, {13.44, 1.31351}, {21.44, 1.74846}, {29.44, 1.83433}, {37.44, 2.06847}, {53.44, 2.36553}, {77.44, 2.53351}}
d = 0.68
p = 8
y110 = 2
y210 = 3
data2 = {{d*p, y110}, {(1 + d)*p, y210}}
ListPlot[{data, data2}, PlotStyle -> {Red, Black}]

notice that I omitted the extra List[…] command