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

Hi all,

When I enter clibraries(), I get:

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

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

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 :slight_smile:

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
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.


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?

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.


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.

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

1 Like

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?

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 Stéfan van der Walt - YouTube. It’s quite an eye-opening talk.


Thank you for the ressources ! I appreciate it.

That does not work unfortunately.

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)

As mentioned on the Julia Downloads 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.

1 Like

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

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

1 Like

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

using Plots
p = heatmap(rand(100,100),color =:jet)

Thank you @moeddel for the ressources!

Wish you well!

1 Like

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