using CairoMakie
function testfig()
fig = Figure()
heatmaps = []
for i = 1:4
h = heatmap!(Axis(fig[i, 1]), i .+ rand(200, 200))
push!(heatmaps, h)
end
Colorbar(fig[:, 2], heatmaps[1]; width=25)
return fig
end
There’s currently no other option of linking colorranges than what you suggested yourself. This is because axes have more infrastructure to facilitate linking, while you could only couple the colorrange observables together, but that would be kind of hacky
From Layout Tutorial · Makie Plotting Ecosystem it seems that’s the right way to do it, except you might still want to do Colorbar(fig[:, 2], heatmaps[1]; width=25) to pick up the colormap from one of the heatmaps (giving the same colorrange to both heatmaps should be enough).