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

**URL:** <https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [January 30, 2021, 1:56pm UTC](https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277 "2021-01-30T13:56:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Staab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter_staab/32/5874_2.png) [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Post date:** [January 30, 2021, 1:56pm UTC](https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277/1 "2021-01-30T13:56:55Z")

</div>

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

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

```

resulting in:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/5/b5a532adb1b5b9a5fb974f1b8c05e41131bd2796.png)

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

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [January 30, 2021, 2:30pm UTC](https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277/2 "2021-01-30T14:30:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Peter\_Staab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter_staab/32/5874_2.png) [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Post date:** [January 31, 2021, 11:58am UTC](https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277/3 "2021-01-31T11:58:14Z")

</div>

Exactly what I was looking for. Worked perfectly.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [January 31, 2021, 12:54pm UTC](https://discourse.julialang.org/t/changing-color-colorbar-limits-in-a-heat-map-in-plots-jl/54277/4 "2021-01-31T12:54:37Z")

</div>

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