Change colours in contour plot

I use the function contour (with fill = “true”) to make contour plots, for this I use Plots.jl. I would however like to change the colour scheme to gray-values, I found that you can do colormap(“Grays”) but this does not change my contour-plot gray. I would also like to adapt my scale (make the low values vary more in color than the high values, i.e. the difference between 0 and 0.084 should be the same as the colour difference between 0.084 and 0.48).

Try something like this:

using Plots
x = y = linspace(-5,5,100)
contour(x, y, (x,y)->cos(x)+cos(y), fill=(true,cgrad(:grays,[0,0.1,1.0])))

3 Likes

Perfect, this is exactly what I needed.
Is there a place where I can find all options you can choose with contour? I didn’t find it in the documentation.

https://juliaplots.github.io/attributes/

I still have a question about these colors:

I have 2 pictures I want to compare but the plotted values do not lie in the same range (i.e. one of them can have higher values than the other). How do I force the color scale of the lower one to go up to the maximum color value of the other one, i.e. adapt the range of the z-values?