How do I change the limits for my colour scale in a CairoMakie contourf
plot?
For instance say I want to plot my data on a contour plot, with a colour bar:
using CairoMakie
M = rand(10, 10) / 10. # get data ∈ [0, 1] and <<1 to illustrate
fig = CairoMakie.Figure()
ax = Axis(fig[1,1])
cplot = CairoMakie.contourf!(fig[1,1], 1:10, 1:10, M)
Colorbar(fig[1,2], cplot)
fig
How can I change the colour limits here?
Passing colorrange=(0,1)
as an argument to countourf
doesn’t work:
fig = CairoMakie.Figure()
ax = Axis(fig[1,1])
cplot = CairoMakie.contourf!(fig[1,1], 1:10, 1:10, M, colorrange=(0,1))
Colorbar(fig[1,2], cplot)
fig
Passing levels=0:0.1:1
as an argument to contourf
works, but it creates this ugly white border around the plot:
fig = CairoMakie.Figure()
ax = Axis(fig[1,1])
cplot = CairoMakie.contourf!(fig[1,1], 1:10, 1:10, M, levels=0:0.1:1)
Colorbar(fig[1,2], cplot)
fig
How can I adjust the colour range without creating a white border?