# How to implement Value Suppressing Colormaps in Makie

**URL:** <https://discourse.julialang.org/t/how-to-implement-value-suppressing-colormaps-in-makie/129140>\
**Category:** Visualization\
**Tags:** makie, colorbar, colormaps\
**Created:** [May 19, 2025, 10:37am UTC](https://discourse.julialang.org/t/how-to-implement-value-suppressing-colormaps-in-makie/129140 "2025-05-19T10:37:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [May 19, 2025, 6:30pm UTC](https://discourse.julialang.org/t/how-to-implement-value-suppressing-colormaps-in-makie/129140/6 "2025-05-19T18:30:29Z")

</div>

I shared this recipe some time ago, maybe this capability should be added to Makie.jl directly?..  
Basically, `image()` but `alpha` can be an array of values:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/2/02b50bf2f8ba822ea46ae7a3c33472bf30b37bff.png)

```julia
@recipe ImageAlpha (
		x::Makie.EndPoints,
		y::Makie.EndPoints,
		image::AbstractMatrix{<:Number}) begin
	Makie.MakieCore.documented_attributes(Makie.Image)...
	alpha = nothing
	alpharange = 0..1
end

function Makie.plot!(p::ImageAlpha)
	alpha = p.alpha[]
	p.alpha = 1
	Makie.color_and_colormap!(p, p.image)
	imcolors = @lift Makie.to_color($(p.calculated_colors))
	alphas_interval = @lift @something(extrema($(p.alpharange)), extrema(alpha))
	alpha = @lift clamp.((alpha .- $alphas_interval[1]) ./ ($alphas_interval[2] - $alphas_interval[1]), 0, 1)
	imcolors_a = @lift Makie.coloralpha.($imcolors, $alpha)
	image!(p, Makie.shared_attributes(p, Image), imcolors_a)
	return p
end

Makie.convert_arguments(::Type{<:ImageAlpha}, args...) = Makie.convert_arguments(ImageLike(), args...)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-implement-value-suppressing-colormaps-in-makie/129140)._
