# Modify colorbar in heatmap

**URL:** <https://discourse.julialang.org/t/modify-colorbar-in-heatmap/78544>\
**Category:** Visualization\
**Tags:** plots\
**Created:** [March 27, 2022, 11:15am UTC](https://discourse.julialang.org/t/modify-colorbar-in-heatmap/78544 "2022-03-27T11:15:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RickDW](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@RickDW](https://discourse.julialang.org/u/RickDW)\
**Post date:** [March 27, 2022, 11:15am UTC](https://discourse.julialang.org/t/modify-colorbar-in-heatmap/78544/1 "2022-03-27T11:15:38Z")

</div>

Hi, I’m trying to create an animation from a sequence of heatmaps, and I want to keep the upper and lower limits of the colorbar steady. I.e. if a value of say 0.5 is plotted using pure white in one frame I want 0.5 to map to white in every single heatmap. This doesn’t happen if in another heatmap the plotted values range from 0.0 to 0.3 for example. I’m using Plots.jl but I’m more than happy to switch to a different library if it supports this.  
I’ve tried to find a way to do this in the documentation but I haven’t been succesful. All I’ve been able to find is the heatmap(cmap=\<…\>) parameter, but this doesn’t seem to be very useful. Could anyone point me in the right direction?

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [March 27, 2022, 2:04pm UTC](https://discourse.julialang.org/t/modify-colorbar-in-heatmap/78544/2 "2022-03-27T14:04:20Z")

</div>

Have you tried the `heatmap()` argument `clims`, to fix the colorbar limits?

---

<div class="post-metadata">

**Author:** ![RickDW](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@RickDW](https://discourse.julialang.org/u/RickDW)\
**Post date:** [March 27, 2022, 3:02pm UTC](https://discourse.julialang.org/t/modify-colorbar-in-heatmap/78544/3 "2022-03-27T15:02:58Z")

</div>

Ah I must have missed that one, that does exactly what I want. Thank you!
