Canonical answer as of Plotly.py 4.0 The built-in continuous colorscales are now documented here, including nice swatches: https://plot.ly/python/builtin-colorscales/ The defaults depend on which template you use, and the default template uses Plasma. See https://plot.ly/python/templates/ for more … Answer from nicolaskruchten on community.plotly.com
🌐
Plotly
plotly.com › python › builtin-colorscales
Built-in continuous color scales in Python
A collection of predefined sequential colorscales is provided in the plotly.colors.sequential module. Sequential color scales are appropriate for most continuous data, but in some cases it can be helpful to use a diverging or cyclical color scale (see below).
🌐
Plotly
plotly.com › python › colorscales
Continuous color scales and color bars in Python
Color scale defaults depend on the layout.colorscales attributes of the active template, and can be explicitly specified using the color_continuous_scale argument for many Plotly Express functions or the colorscale argument in various graph_objects such as layout.coloraxis or marker.colorscale in go.Scatter traces or colorscale in go.Heatmap traces.
🌐
GeeksforGeeks
geeksforgeeks.org › python › built-in-continuous-color-scales-in-python-plotly
Built-in Continuous Color Scales in Python Plotly - GeeksforGeeks
July 23, 2025 - Plotly has a wide variety of built-in continuous color scales that can be referenced in Python code when specifying the arguments, either by name or by reference.
🌐
Plotly
plotly.com › r › builtin-colorscales
Built-in continuous color scales in R
A reference for the built-in named continuous (sequential, diverging and cyclical) color scales in Plotly.
🌐
Plotly
plotly.com › r › colorscales
Colorscales | R | Plotly
Note that multiple color scales can be linked to the same color. library(plotly) fig1 <- plot_ly( type = "heatmap", x = c(1,2,3,4), z = list(c(1,2,3,4), c(4,-3,-1,1)), coloraxis = 'coloraxis') fig2 <- plot_ly( type = "heatmap", x = c(3,4,5,6), z = list(c(10,2,1,0), c(4,3,5,6)), coloraxis = 'coloraxis') fig <- subplot(fig1, fig2) fig <- fig %>% layout(coloraxis=list(colorscale='Jet')) fig
🌐
Plotly
plotly.com › python-api-reference › generated › plotly.colors.html
plotly.colors package — 7.1.0 documentation
Takes a single color or an iterable of colors, as well as a list of scale values, and outputs a 2-pair of the list of color(s) converted all to an rgb or tuple color type, as well as the scale as the second element. If colors is a Plotly Scale name, then ‘scale’ will be forced to the scale from the respective colorscale and the colors in that colorscale will also be converted to the selected colortype.
🌐
Plotly
plotly.com › python › discrete-color
Discrete colors in Python
This works because just like in px.colors.qualitative, all built-in continuous color scales are stored as lists of CSS colors: ... ['#0d0887', '#46039f', '#7201a8', '#9c179e', '#bd3786', '#d8576b', '#ed7953', '#fb9f3a', '#fdca26', '#f0f921'] Dash is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library.
🌐
Plotly
plotly.com › javascript › colorscales
Colorscales in JavaScript
d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) { var data = [{ z: figure.z, colorscale: [ ['0.0', 'rgb(165,0,38)'], ['0.111111111111', 'rgb(215,48,39)'], ['0.222222222222', 'rgb(244,109,67)'], ['0.333333333333', 'rgb(253,174,97)'], ['0.444444444444', 'rgb(254,224,144)'], ['0.555555555556', 'rgb(224,243,248)'], ['0.666666666667', 'rgb(171,217,233)'], ['0.777777777778', 'rgb(116,173,209)'], ['0.888888888889', 'rgb(69,117,180)'], ['1.0', 'rgb(49,54,149)'] ], type: 'heatmap' }]; Plotly.newPlot('myDiv', data); });
🌐
PYTHON CHARTS
python-charts.com › home › plotly color scales
Plotly color scales [Full List] | PYTHON CHARTS
July 29, 2026 - Full list of plotly built-in color scales: sequential, diverging, cyclical and qualitative. Click on a color scale to copy its name and use it in plotly express.
Find elsewhere
🌐
Plotly
community.plotly.com › 📊 plotly python
What colorscales are available in plotly, and which are the default? - 📊 Plotly Python - Plotly Community Forum
September 10, 2016 - Very confused. “Viridis” is available, but not mentioned in the documentation. There is a link Redirecting… that shows a lot of color scales, but since it’s missing Viridis, I don’t know what else it’s missing. And also…
🌐
Plotly
plotly.com › python-api-reference › generated › plotly.express.colors.html
plotly.express.colors package — 7.1.0 documentation
Takes a single color or an iterable of colors, as well as a list of scale values, and outputs a 2-pair of the list of color(s) converted all to an rgb or tuple color type, as well as the scale as the second element. If colors is a Plotly Scale name, then ‘scale’ will be forced to the scale ...
🌐
GitHub
github.com › plotly › plotly.py › blob › main › doc › python › builtin-colorscales.md
plotly.py/doc/python/builtin-colorscales.md at main · plotly/plotly.py
A collection of predefined sequential colorscales is provided in the plotly.colors.sequential module. Sequential color scales are appropriate for most continuous data, but in some cases it can be helpful to use a diverging or cyclical color scale (see below).
Author: plotly
🌐
Plotly
plotly.com › ggplot2 › colorscales
Continuous color scales and color bars in ggplot2
library(plotly) library(ggplot2) df <- data.frame( x = runif(100), y = runif(100), z1 = rnorm(100), z2 = abs(rnorm(100)) ) p <- ggplot(df, aes(x, y)) + geom_point(aes(colour = z1)) + scale_colour_gradient2() ggplotly(p)
🌐
GitHub
github.com › plotly › colorlover
GitHub - plotly/colorlover: Color scales in Python for humans · GitHub
>>> cl.to_rgb( cl.scales['3']['div']['RdYlBu'] ) ['rgb(252,141,89)', 'rgb(255,255,191)', 'rgb(145,191,219)'] Traverse color scale dictionary and return available color scales as HTML string
🌐
Plotly
community.plotly.com › 📊 plotly python
How can I make custom color scales? - 📊 Plotly Python - Plotly Community Forum
November 8, 2023 - Is it possible to make custom color scales instead of using the built-in ones? I would like to make a custom color scale to use in my plots (scatter plots generally I think) in which I can set the colors. For example blue for negative numbers , red for positive numbers and…
🌐
Plotly
plotly.com › fsharp › logarithmic-color-scale
Continuous Color Scales and Color Bars | Fsharp | Plotly
Added Kernel Extension including formatters for Plotly.NET charts. ... let z=[[0;1;2;3;4;5;6;7;8;9]] let customColorscale = StyleParam.Colorscale.Custom [(0.0,"#000000");(1.0,"#B4B4B4")]
Top answer
1 of 6
20

There is a built in method from plotly.express.colors to sample_colorscale which would provide the color samples:

from plotly.express.colors import sample_colorscale

import plotly.graph_objects as go
import numpy as np

x = np.linspace(0, 1, 25)
c = sample_colorscale('jet', list(x))

fig = go.FigureWidget()
fig.add_trace(
    go.Bar(x=x, y=y, marker_color=c)
)
fig.show()

See the output figure -> sampled_colors

2 of 6
16

Plotly does not appear to have such a method, so I wrote one:

import plotly.colors

def get_continuous_color(colorscale, intermed):
    """
    Plotly continuous colorscales assign colors to the range [0, 1]. This function computes the intermediate
    color for any value in that range.

    Plotly doesn't make the colorscales directly accessible in a common format.
    Some are ready to use:
    
        colorscale = plotly.colors.PLOTLY_SCALES["Greens"]

    Others are just swatches that need to be constructed into a colorscale:

        viridis_colors, scale = plotly.colors.convert_colors_to_same_type(plotly.colors.sequential.Viridis)
        colorscale = plotly.colors.make_colorscale(viridis_colors, scale=scale)

    :param colorscale: A plotly continuous colorscale defined with RGB string colors.
    :param intermed: value in the range [0, 1]
    :return: color in rgb string format
    :rtype: str
    """
    if len(colorscale) < 1:
        raise ValueError("colorscale must have at least one color")

    if intermed <= 0 or len(colorscale) == 1:
        return colorscale[0][1]
    if intermed >= 1:
        return colorscale[-1][1]

    for cutoff, color in colorscale:
        if intermed > cutoff:
            low_cutoff, low_color = cutoff, color
        else:
            high_cutoff, high_color = cutoff, color
            break

    # noinspection PyUnboundLocalVariable
    return plotly.colors.find_intermediate_color(
        lowcolor=low_color, highcolor=high_color,
        intermed=((intermed - low_cutoff) / (high_cutoff - low_cutoff)),
        colortype="rgb")

The challenge is that the built-in Plotly colorscales are not consistently exposed. Some are defined as a colorscale already, others as just a list of color swatches that must be converted to a color scale first.

The Viridis colorscale is defined with hex values, which the Plotly color manipulation methods don't like, so it's easiest to construct it from swatches like this:

viridis_colors, _ = plotly.colors.convert_colors_to_same_type(plotly.colors.sequential.Viridis)
colorscale = plotly.colors.make_colorscale(viridis_colors)

get_continuous_color(colorscale, intermed=0.25)
# rgb(58.75, 80.75, 138.25)
🌐
Naomi Aro
naomiaro.hashnode.dev › how-to-create-custom-continuous-and-discrete-colorscales-with-plotlyjs
How to create custom continuous and discrete colorscales with Plotly.js
September 9, 2024 - We'll set tick0 to be -13.5. This attribute describes what the 0 entry of your colorscale should describe. We'll also need to set dtick to be an increment of 1.5. From the image of the legend we're trying to recreate, we can see each coloured box is supposed to describe an elevation of 1.5 feet. Lastly, to put everything together here are a couple of codepens which have the continuous and discrete colour scales defined.
🌐
Notebook Community
notebook.community › empet › Plotly-plots › Plotly-asymmetric-colorscales
Plotly asymmetric diverging colorscales adapted to data
We illustrate below how we can define a custom diverging matplotlib colormap, respectively a Plotly colorscale, starting with a list of three colors (left, mid and right color).