Using Makie for contour plot with only one edge

I want a 2D contour plot which shows the boundary where “matrix” becomes larger than zero. I do:
CairoMakie.contour(matrix,levels = [0.0])
The last step to make me happy would be to set the color of the boundary line. Right now it uses the colormap somehow, but I would like to exactly set the color of this line. Any suggestions?

Hm maybe try setting a one color colormap? Like colormap = [:red].

2 Likes

Exactly what I was looking for! Couldn’t figure that one can define a colormap with only one color :grinning: But it works! Thanks!!

This is a bit of an edge case as contour is assumed to usually have multiple levels, so it doesn’t even offer the color keyword to override with a static color. Hence the one color colormap hack.

1 Like