Changing color/colorbar limits in a heat map in Plots.jl

I’m looking to change the range of colors on a heat map. For example:

hm1 = heatmap(rand(20,20),aspect_ratio=:equal)
hm2 = heatmap(0.9*rand(20,20),aspect_ratio=:equal)
plot(hm1,hm2)

resulting in:

defaults to 0->1 on the left and 0->0.9 on the right. I’d like scale the left one to match the right one. I’ve tried using zlims, which doesn’t seem to work.

Running Julia 1.5.3 and Plots.jl v1.10.2

clim (or clims?) is what you are looking for.

7 Likes

Exactly what I was looking for. Worked perfectly.

Cool. You can mark it as solved, so others see that there is no more input needed, without having to open the thread.

1 Like