Quick question on colors in a contour plot


I’m making a contour plot using something like

using Plots
p1 = plot(xoffsets, zerrs, out, st=:contour, levels=0.0:0.05:1.00)

The plot works but I want to change the color series (the default colors for values near 1.00 go to yellow, which disappears against white.)


color = one of the many inbuilt color schemes Colors · Plots?

1 Like

Thank you.

I had tried that, but only in a modifying style which doesn’t seem to work. Specifically, this

p1 = plot(xoffsets, zerrs, out, st=:contour, color=:greys, levels=0.0:0.05:1.00)

works, but

plot!(p1, color=:blues)

doesn’t change the colors of the plot I just made. Am I wrong to expect it to?

No you’re not wrong as such, in that it works for certain types of attributes. But you can’t update attributes of a Series with plot! (which is geared towards adding new series). Axis, SubPlot and Plot attributes are updateable like that, by plotting again to the plot with no input data and different attributes.

1 Like

Thank you, I see now that there is a hint in the docs:

You can update certain plot settings after plot creation