# Makie - Clipped heatmap

**URL:** <https://discourse.julialang.org/t/makie-clipped-heatmap/70014>\
**Category:** Visualization\
**Tags:** makie\
**Created:** [October 19, 2021, 7:26am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014 "2021-10-19T07:26:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [October 19, 2021, 7:26am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014/1 "2021-10-19T07:26:14Z")

</div>

Hello!

Is there a way to get a clipped heatmap in Makie? MWE would be:

```julia
# Packages
using GLMakie
GLMakie.activate!()

# Ranges
a = -3:0.033:3
b = -3:0.033:3

# Function
f(x,y) = (x*y)/(1-abs(x+y))

# Plot
_fig = Figure()
_hmap = heatmap(_fig[1,1], a, b, f)

```

 ![NonClipped](https://global.discourse-cdn.com/julialang/original/3X/b/6/b685d3fd4760ad9030a63eb3deb3d0df5eaf65a5.png)

Obviously, it should not be totally green, but the singularities get all the color, and the rest none.  
Is there a way I can limit (in a heatmap, not `contourf`) the values for the color gradient?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 19, 2021, 7:43am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014/2 "2021-10-19T07:43:50Z")

</div>

Oh the heatmap page really needs more examples. Have a look at the upper right plot in the example at the bottom on this page [https://makie.juliaplots.org/stable/examples/layoutables/colorbar/](https://makie.juliaplots.org/stable/examples/layoutables/colorbar/)

---

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [October 19, 2021, 7:46am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014/3 "2021-10-19T07:46:41Z")

</div>

Whoa, yeah, that was obscure.

What does `colorrange` do exactly?

Also, is there a way to control exactly from which value to which value are gradient colors used, and when are clipped colors used?

Are these two questions the same? 😆

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 19, 2021, 7:53am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014/4 "2021-10-19T07:53:55Z")

</div>

Either the range of colormap lookup is determined automatically as the extrema of the data, or you set it manually with colorrange. If there are values exceeding the range, you can either leave them saturated at the extreme color value, or give them a separate color with highclip and lowclip

---

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [October 19, 2021, 7:55am UTC](https://discourse.julialang.org/t/makie-clipped-heatmap/70014/5 "2021-10-19T07:55:21Z")

</div>

Yay, nice, thanks a lot!
