# Setting min and max values in a heatmap (Plots.jl)

**URL:** <https://discourse.julialang.org/t/setting-min-and-max-values-in-a-heatmap-plots-jl/36496>\
**Category:** Visualization\
**Tags:** question\
**Created:** [March 25, 2020, 2:42pm UTC](https://discourse.julialang.org/t/setting-min-and-max-values-in-a-heatmap-plots-jl/36496 "2020-03-25T14:42:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 25, 2020, 2:42pm UTC](https://discourse.julialang.org/t/setting-min-and-max-values-in-a-heatmap-plots-jl/36496/1 "2020-03-25T14:42:30Z")

</div>

I am making heatmaps of a discrete function taking values 0…5 . Plots (GR) makes automatic scaling for me: min is green, max is red (with `seriescolor=RdYlGn_r` ). I want the heatmaps to have **the same** “color scale” - 0 is green, 5 is red, even if I only have values e.g. 0…2 . Is it possible?

Similar, but not the same problem was discussed here [Plots.jl: How can I get discrete colors in the colorbar of a heatmap?](https://discourse.julialang.org/t/plots-jl-how-can-i-get-discrete-colors-in-the-colorbar-of-a-heatmap/29660) and here [Discrete heatmap in Plots.jl](https://discourse.julialang.org/t/discrete-heatmap-in-plots-jl/35708)

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [March 25, 2020, 3:18pm UTC](https://discourse.julialang.org/t/setting-min-and-max-values-in-a-heatmap-plots-jl/36496/2 "2020-03-25T15:18:48Z")

</div>

use the argument `clim`?

---

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [March 25, 2020, 3:39pm UTC](https://discourse.julialang.org/t/setting-min-and-max-values-in-a-heatmap-plots-jl/36496/3 "2020-03-25T15:39:38Z")

</div>

thanks a lot!
