# Current list of colorschemes in Plots.jl

**URL:** <https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420>\
**Category:** Visualization\
**Tags:** question, plotting\
**Created:** [August 17, 2017, 5:18am UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420 "2017-08-17T05:18:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 17, 2017, 5:18am UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/1 "2017-08-17T05:18:59Z")

</div>

Is there a command to find out all the currently defined colorschemes? The one below that used to work is not working anymore:

```julia
PlotUtils._gradients |> keys |> showall

```

---

<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:** [August 17, 2017, 8:44am UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/2 "2017-08-17T08:44:23Z")

</div>

Color gradients in Plots are arranged into color libraries. You don’t need to know or specify the color library to pick a color scheme, but they are useful for exploration. To get a list of all color libraries in Plots, use the `clibraries` function:

```julia
julia> clibraries()
5-element Array{Symbol,1}:
 :Plots
 :cmocean
 :misc
 :colorcet
 :colorbrewer

```

All but the `:misc` library are restricted to colorgradients that live up to the perceptual uniformity standards for scientific visualization (so you’ll have to look in the `:misc` library for a rainbow gradient). The Plots color library is loaded by default.  
You can get a list of colorschemes in each gradient by calling e.g. `cgradients(:colorcet)`. Or, you can use the `showlibrary` function to get a visual representation, e.g.

```julia
showlibrary(:Plots)

```

![55](https://global.discourse-cdn.com/julialang/original/3X/9/4/94ae6ef02261f33a602d9564ac6296725e171177.png)

Each color library also defines a default gradient (`:magma` in the case of `:Plots`), a `:sequential` gradient, and a `:diverging` gradient (for color gradients that are brightest in the middle - in `:Plots` this is the `:pu_or` gradient).

You can change the active color library by `clibrary(:colorbrewer)`. You can use any color gradient regardless of library by passing its name to the `color` attribute in Plots, but in case of namespace clashes (e.g. there are multiple `:blues`) it will default to the one in the current library.

I should add that you can reverse any color gradient by appending “\_r”, e.g. `:viridis_r`.

I would strongly recommend exploring the `:colorbrewer` ([from here](http://colorbrewer2.org/)), `:colorcet` ([from e.g. here](https://github.com/peterkovesi/PerceptualColourMaps.jl)) and `:cmocean` ([from here](http://kristenthyng.com/blog/2015/10/28/cmocean/)) libraries, they are very nice.

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [August 17, 2017, 2:30pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/3 "2017-08-17T14:30:24Z")

</div>

This is an awesome answer @mkborregaard! All I always wanted to know about colorschemes in Plots.jl, a big 👍

Thanks for answering in detail, this will serve as documentation for future users.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [August 30, 2017, 11:34pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/4 "2017-08-30T23:34:25Z")

</div>

This is indeed an excellent guide! Is there an equivalent for selecting discrete colors rather than gradients? In other words, if I do

```julia
ys = rand(10,5)
plot(ys)

```

Colors are picked in order, it seems to maximize contrast. Is there a way to look at what the order is, or change it?

---

<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:** [August 31, 2017, 5:56am UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/5 "2017-08-31T05:56:44Z")

</div>

The colors of different series is as default set with the `distinguishable_colors` function from Colors.jl, in order to maximize the contrast to the background. You can change it with the `color_palette` attribute, either passing a vector of colors to choose from, or the name of a gradient (it will select distinguishable colors from that gradient).

Alternatively you can set the look of all your plots with `theme`, e.g. to make the look of plots match your visual theme in juno:

```julia
theme(:juno)
p1=plot([cumsum(randn(100)) cumsum(randn(100))])
theme(:sand)
p2 = plot([sin, cos])
theme(:default)
plot(p,p2)

```

 ![32](https://global.discourse-cdn.com/julialang/original/3X/f/8/f89d2478f0a1be678c7ebd18dc72a531f4a36cfb.png)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [September 1, 2017, 3:24pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/6 "2017-09-01T15:24:00Z")

</div>

@mkborregaard, adding to the thread, how do you construct a color gradient with N specific colors? (e.g. `[:red, :yellow, :blue]`)

---

<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:** [September 1, 2017, 4:39pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/7 "2017-09-01T16:39:42Z")

</div>

You can’t at the moment. Color gradients in Plots are stretched/interpolated. A classified color map is on the todo:  
[https://github.com/JuliaPlots/Plots.jl/issues/118](https://github.com/JuliaPlots/Plots.jl/issues/118)  
[https://github.com/JuliaPlots/Plots.jl/issues/383](https://github.com/JuliaPlots/Plots.jl/issues/383)  
[https://github.com/JuliaPlots/PlotUtils.jl/issues/3](https://github.com/JuliaPlots/PlotUtils.jl/issues/3)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [September 1, 2017, 5:55pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/8 "2017-09-01T17:55:53Z")

</div>

@mkborregaard, I was asking for an interpolation method actually that given 3 colors let’s say, generates the color gradient. I just found the solution by digging into the source code:

```julia
using Plots

A = [i for i=1:100, j=1:100]

heatmap(A, c=ColorGradient([:red,:yellow,:blue]))

```

![download](https://global.discourse-cdn.com/julialang/original/3X/7/3/731deaa7ec715d2469d9d456ccc967859ce04da1.png)

---

<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:** [September 1, 2017, 6:26pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/9 "2017-09-01T18:26:55Z")

</div>

Ah, I misunderstood. The syntax is actually `heatmap(A, c=cgrad([:red,:yellow,:blue]))`. The `cgrad` function also lets you associate each of the colors with a certain value, create uneven interpolations, specify that the color scale should be e.g. logged, and set an alpha value for the gradient. It’s all in the source code 🙂 You know, I think I should move some of this post to the Plots docs 🙂

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [September 1, 2017, 8:10pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/10 "2017-09-01T20:10:11Z")

</div>

That would be great! Thanks for sharing the right way 🙂

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 6, 2018, 4:49pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/11 "2018-03-06T16:49:41Z")

</div>

> [@mkborregaard](#):
>
> move some of this post to the Plots docs

💯

---

<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:** [March 6, 2018, 7:50pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/12 "2018-03-06T19:50:59Z")

</div>

[http://docs.juliaplots.org/latest/colors/](http://docs.juliaplots.org/latest/colors/)

Is anything still missing from there in your view @yakir12?

---

<div class="post-metadata">

**Author:** ![waldyrious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/waldyrious/32/80_2.png) [@waldyrious](https://discourse.julialang.org/u/waldyrious)\
**Post date:** [March 6, 2018, 8:37pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/13 "2018-03-06T20:37:42Z")

</div>

> [@mkborregaard](#):
>
> Is anything still missing from there

IMO what you said [earlier in this thread](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/2):

> All but the `:misc` library are restricted to colorgradients that live up to the perceptual uniformity standards for scientific visualization

… is not clear in the docs, especially since the section on the Colorcet library is the only one that mentions perceptual uniformness (making it seem like none of the others have this property).

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 6, 2018, 9:04pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/14 "2018-03-06T21:04:49Z")

</div>

@mkborregaard, this is really great. Thank you very much. I especially think that the [tutorial](https://github.com/JuliaPlots/ExamplePlots.jl/blob/master/notebooks/cgrad.ipynb) is useful. I was especially after the logarithmic color scale, a very cool option for heatmaps.

---

<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:** [March 6, 2018, 9:15pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/15 "2018-03-06T21:15:19Z")

</div>

Cool it’s useful - thank @SaschaMann who did the PR 🙂 The tutorial is really old and should perhaps be revisited 🙂 It’s an original by Tom Breloff.

@waldyrious yes that’s a good point 👍

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 6, 2018, 9:22pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/16 "2018-03-06T21:22:09Z")

</div>

Very useful info in this thread!

I’ve always wondered about colors. Is it so that symbols for the CSS color names are supported, [HTML Color Groups](https://www.w3schools.com/colors/colors_groups.asp) ? Seems like one can use symbols with the CSS color names in lowercase…, e.g.:

p1 = plot(x,y,lc=:red,label=L"\sin(x)\exp(-x/6)“);  
p2 = plot(x,z,lc=:green,label=L”\cos(x)\exp(-x/8)“);  
p3 = plot(x,u,lc=:cornflowerblue,label=L”\sinc(x)");

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 6, 2018, 9:24pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/17 "2018-03-06T21:24:47Z")

</div>

Some info I have had problems finding, related to layout… for more specialized layout, e.g:

plot(p1,p2,p3,p4, layout = @layout [a{0.4w} [b c;d]])

…is it so that “a”, “b”, “c”, “d” is some reference to p1, p2, p3, p4? (I assume so…), but I haven’t really found clear explanation of this.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [March 6, 2018, 9:29pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/18 "2018-03-06T21:29:20Z")

</div>

A final couple of things I have wished for…

- When doing parametric plots, e.g., with phase plots with time as parameter, it would be really useful to let the color of the curve change with the parameter. One can do this by splitting up the curve of N elements in N-1 straight lines, and assign a new color to each segment – e.g., using linspace between two RGB colors, but the resulting plotting is really slow.

- I have tried to use 3D plot with contours. Doesn’t look nice if the min value of the surface is close to zero – this tends to hide the contours. It would be useful if one could specify at which “z” value the contours should appear. (This can relatively easily be done with Matplotlib/Pyplot).

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [March 6, 2018, 9:51pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/19 "2018-03-06T21:51:11Z")

</div>

> [@BLI](#):
>
> When doing parametric plots, e.g., with phase plots with time as parameter, it would be really useful to let the color of the curve change with the parameter. One can do this by splitting up the curve of N elements in N-1 straight lines, and assign a new color to each segment – e.g., using linspace between two RGB colors, but the resulting plotting is really slow.

`plot(rand(10), line_z = 0.1:0.1:1)`

> [@BLI](#):
>
> I have tried to use 3D plot with contours. Doesn’t look nice if the min value of the surface is close to zero – this tends to hide the contours. It would be useful if one could specify at which “z” value the contours should appear. (This can relatively easily be done with Matplotlib/Pyplot).

`contour(rand(10,10), levels = [0.2, 0.5])`

Concerning layout, [this tutorial](http://docs.juliaplots.org/latest/layouts/) may be helpful.

As a general rule though, this (a topic about colorschemes) is not the preferred place to ask usage questions about plots, either the gitter or the slack channels are probably better. Also, make sure to go through the documentation before asking and, once you figure out something that was not documented, please consider opening a PR to improve the documentation (which you can find [here](https://github.com/JuliaPlots/PlotDocs.jl)).

---

<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:** [March 6, 2018, 9:51pm UTC](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420/20 "2018-03-06T21:51:55Z")

</div>

And yes, CSS color names are supported.

[Next page](https://discourse.julialang.org/t/current-list-of-colorschemes-in-plots-jl/5420.md?page=2)
