# How to plot a heatmap using jet colormap or/and other matplotlib colormaps

**URL:** <https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974>\
**Category:** Visualization\
**Tags:** question, plotting, colors, visualization\
**Created:** [February 10, 2021, 9:47am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974 "2021-02-10T09:47:16Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 9:47am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/1 "2021-02-10T09:47:16Z")

</div>

Hi all,

When I enter clibraries(), I get:

> julia\> clibraries()  
> 5-element Array{Symbol,1}:  
> :Plots  
> :cmocean  
> :misc  
> :colorcet  
> :colorbrewer  
> Misc, is supposed to contain the jet colormap, when I try this simple code

```julia
using Plots
using ColorSchemes
gr()
p = heatmap(rand(100,100), aspect_ratio=:equal, axis=false,c =:jet)
display(p)

```

I get the error:

> ERROR: LoadError: Unknown color: jet

When I try to use `jet1` from matplotlib for instance, I get the exact same error.

What should I do if I want to use the `jet` colormap from misc or any other colormap from matplotlib?

Thank you for your attention 🙂

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 10, 2021, 9:57am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/2 "2021-02-10T09:57:48Z")

</div>

Are you using an old version of Plots? `clibraries` isn’t used anymore - today you can use all color schemes from ColorSchemes.jl. Check these docs: [ColorSchemes · Plots](https://docs.juliaplots.org/latest/generated/colorschemes/)  
This includes `jet1` as well as all other matplotlib schemes.  
Note though that the `jet` color gradient doesn’t fulfill the criteria for a good color scheme in scientific visualization - I’d strongly suggest finding an alternative.

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 10:11am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/3 "2021-02-10T10:11:52Z")

</div>

I am working on an MRI project and `jet` is asked by my supervisor. I already checked the docs. Do you know how to solve the error I am facing?

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 10, 2021, 10:31am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/4 "2021-02-10T10:31:39Z")

</div>

Yes I literally describe exactly what to do above. You should update Plots (make sure you are on a recent version of Julia too) and follow the documentation in the link I posted.

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 11:03am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/5 "2021-02-10T11:03:49Z")

</div>

Thank you!  
When I try to update julia on Debian, it said that julia is already up to date. In fact, I am currently running julia 1.0.3. but the Debian repo do not have any further version available (using apt). This is certainly the problem.

This means I have to install it manually. I really don’t like going manually in usr/share and those sorts of files to install things because I always fear to have different versions at the same time and not knowing how to use one or the other, and then not being able to completely remove and purge one or the other.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 10, 2021, 11:12am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/6 "2021-02-10T11:12:22Z")

</div>

Ah, yes, the Debian repo is really outdated. Can you install from Snap on Debian? I believe that is recent. Otherwise these are the official installation instructions [Platform Specific Instructions for Official Binaries](https://julialang.org/downloads/platform/#linux_and_freebsd)

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 10, 2021, 11:14am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/7 "2021-02-10T11:14:49Z")

</div>

or, if you want to stay with your current julia version, `clibrary(:misc)` should bring it into the namespace, so you can call it with `color = :jet`. Does that not work?

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [February 10, 2021, 11:31am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/8 "2021-02-10T11:31:35Z")

</div>

MRI in terms of Magnetic Resonance Imaging? If yes, please show your supervisor this video: [A Better Default Colormap for Matplotlib | SciPy 2015 | Nathaniel Smith and Stéfan van der Walt - YouTube](https://www.youtube.com/watch?v=xAoljeRJ3lU). It’s quite an eye-opening talk.

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 11:56am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/9 "2021-02-10T11:56:02Z")

</div>

Thank you for the ressources ! I appreciate it.

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 11:58am UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/10 "2021-02-10T11:58:36Z")

</div>

That does not work unfortunately.

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 12:07pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/11 "2021-02-10T12:07:06Z")

</div>

Regarding snap on my Debian

> ~$ sudo snap search julia  
> Name Version Publisher Notes Summary  
> julia 1.0.4 julialang✓ classic The Julia programming language  
> julia-mrcinv 1.4.2 mrcinv classic The Julia programming language  
> hledger-jak 0.21.3+git5236.70b03d87 juliank - An easy-to-use command-line/curses/web plaintext accounting tool

Should I download the one from mrcinv? (eventhough it is not from julialang)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [February 10, 2021, 12:18pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/12 "2021-02-10T12:18:31Z")

</div>

As mentioned on the [Julia Downloads](https://julialang.org/downloads/platform/#linux_and_freebsd) page for linux, which Michael linked to above:

> It is strongly recommended that the official generic binaries from the downloads page be used to install Julia on Linux

So I would really encourage you to follow this advice if at all possible - you don’t have to do much else than unzip a file on your local harddrive (and add Julia’s location to your `PATH` or create a symlink if desired), and you’ll save yourself a lot of trouble down the line.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [February 10, 2021, 12:30pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/13 "2021-02-10T12:30:47Z")

</div>

OK, what are your versions of Plots, PlotUtils and RecipesBase? Could be a version mismatch.

---

<div class="post-metadata">

**Author:** ![moeddel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeddel/32/18641_2.png) [@moeddel](https://discourse.julialang.org/u/moeddel)\
**Post date:** [February 10, 2021, 12:48pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/14 "2021-02-10T12:48:33Z")

</div>

> [@Valery](#):
>
> I am working on an MRI project and `jet` is asked by my supervisor.

Do you know why your supervisor wants you to use `jet`? Of all the color maps out there `jet` has a number of problems (sharp transitions when the map is applied to images, where the underlying data is actually smoothly varying, very unfriendly to color blind users). Still if you have a application, where “rainbow maps” are preferred since they show more detail at the expense of accuracy, I can recommend this article by Anton Mikhailov

> **[Turbo, An Improved Rainbow Colormap for Visualization](https://blog.research.google/2019/08/turbo-improved-rainbow-colormap-for.html)**

---

<div class="post-metadata">

**Author:** ![Valery](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/valery/32/21803_2.png) [@Valery](https://discourse.julialang.org/u/Valery)\
**Post date:** [February 10, 2021, 1:17pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/15 "2021-02-10T13:17:37Z")

</div>

In the end, I installed julia 1.5.3 using the archive on the website: it solved all of my problems. Thank you @mkborregaard and @nilshg.

Now, the versions are:

> - Plots v1.10.4
> - PlotUtils v1.0.10
> - RecipesBase v1.1.1

The code down below works as intended

```julia
using Plots
gr()
p = heatmap(rand(100,100),color =:jet)
display(p)

```

Thank you @moeddel for the ressources!

Wish you well!

---

<div class="post-metadata">

**Author:** ![fgerick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fgerick/32/13228_2.png) [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Post date:** [February 10, 2021, 8:13pm UTC](https://discourse.julialang.org/t/how-to-plot-a-heatmap-using-jet-colormap-or-and-other-matplotlib-colormaps/54974/16 "2021-02-10T20:13:16Z")

</div>

First time I’m not happy a problem got solved here 😅
