# Makie.jl: How to color a density plot according to a given colormap/colorbar

**URL:** https://discourse.julialang.org/t/makie-jl-how-to-color-a-density-plot-according-to-a-given-colormap-colorbar/60575
**Category:** General Usage
**Tags:** plotting, statistics, makie
**Created:** [May 5, 2021, 1:10pm UTC](https://discourse.julialang.org/t/makie-jl-how-to-color-a-density-plot-according-to-a-given-colormap-colorbar/60575 "2021-05-05T13:10:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![briochemc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/briochemc/32/4209_2.png) [@briochemc](https://discourse.julialang.org/u/briochemc)
#### Post date: [May 5, 2021, 1:10pm UTC](https://discourse.julialang.org/t/makie-jl-how-to-color-a-density-plot-according-to-a-given-colormap-colorbar/60575/1 "2021-05-05T13:10:06Z")

</div>

Is it possible to color densities according to a given colormap/colorbar?

@yakir12 already helped me on zulip with the “ridgeplot layout” of the densities [as shown in the docs](https://makie.juliaplots.org/stable/plotting_functions/density.html), which worked for me like below:

 ![Screen Shot 2021-05-05 at 11.06.44 pm](https://global.discourse-cdn.com/julialang/original/3X/4/7/47c1788efb618e81836ed3cb9a38ca3b1414db78.jpeg)

But I’d love to add coloring as well, like shown in the picture below 🙂 (I don’t care about transparency BTW)

![image](https://global.discourse-cdn.com/julialang/original/3X/7/0/7095d5c63b9277cd919181bdfa3814f8943d7c44.jpeg)

(cc @jules)

---

<div class="post-metadata">

### Author: ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)
#### Post date: [January 10, 2024, 9:47am UTC](https://discourse.julialang.org/t/makie-jl-how-to-color-a-density-plot-according-to-a-given-colormap-colorbar/60575/2 "2024-01-10T09:47:13Z")

</div>

Just because I found this post while searching for ridgeplots in Makie and it came up quite high in the search results.  
The answer to that question is now available in the Makie docs.  
[https://docs.makie.org/stable/reference/plots/density/#gradients](https://docs.makie.org/stable/reference/plots/density/#gradients)
