Using only a part of a colormap in Makie

You can make your own colormap with e.g. cgrad, and use it with colormap=.... following the documentation:

https://docs.juliaplots.org/latest/generated/colorschemes/#ColorGradient

example code:

using GLMakie
GLMakie.activate!()

cm = cgrad([:blue, :red])

xs = LinRange(0, 20, 50)
ys = LinRange(0, 15, 50)
zs = [cos(x) * sin(y) for x in xs, y in ys]

fig = Figure()

ax, hm = heatmap(fig[1, 1], xs, ys, zs, colormap=cm)
Colorbar(fig[1, 2], hm)

fig