🌐
Plotly
plotly.com › python › builtin-colorscales
Built-in continuous color scales in Python
px.scatter(color_continuous_scale="Viridis") or by reference e.g. go.Scatter(marker_colorscale=plotly.colors.sequential.Viridis). They can also be reversed by adding _r at the end e.g.
🌐
Plotly
plotly.com › python › colorscales
Continuous color scales and color bars in Python
The Plotly Express color_continuous_scale argument accepts explicitly-constructed color scales as well. The Graph Objects colorscale parameter also accepts an explicitly-constructed color scale, as shown in the example below.
🌐
Plotly
plotly.com › r › colorscales
Colorscales | R | Plotly
library(plotly) fig <- plot_ly( type = 'scatter', mode='markers', y=rep(5, 40), marker=list( size=seq(0, 39), color=seq(0, 39), colorbar=list( title='Colorbar' ), colorscale='Viridis', reversescale =T ) ) fig <- fig %>% layout( xaxis = list( showgrid = F, zeroline = F ), yaxis = list( showgrid = F, zeroline = F ) )
🌐
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 › python › reference › layout › coloraxis
Layout.coloraxis in Python
For example, `[[0, 'rgb(0,0,255)'], ... string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd....
🌐
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 › python-api-reference › generated › plotly.colors.html
plotly.colors package — 7.1.0 documentation
Interpolates between colors in a colorscale to find the specific colors corresponding to the specified sample values. The colorscale can be specified as a list of [scale, color] pairs, as a list of colors, or as a named plotly colorscale.
🌐
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: 'YlOrRd', type: 'heatmap' } ]; var layout = { title: { text: 'YlOrRd' } }; Plotly.newPlot('myDiv', data, layout); });
🌐
Plotly
plotly.net › general › working-with-colors.html
Working with colors | Plotly.NET
PatternShape: PatternShape * ... * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColor: Color * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerColorScale: Colorscale * [<Optional; DefaultParameterValue ((null :> obj))>] ?MarkerOutline: Line * [<Optional; ...
Find elsewhere
🌐
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 - colorscale: [ [0, 'rgb(253, 180, 7)'], // -13.5 -> -12.0 feet [0.111, 'rgb(253, 180, 7)'], // -13.5 -> -12.0 feet [0.111, 'rgb(255, 217, 109)'], // -12.0 -> -10.5 feet [0.222, 'rgb(255, 217, 109)'], // -12.0 -> -10.5 feet [0.222, 'rgb(253, 180, 7)'], // -10.5 -> -9.0 feet [0.333, 'rgb(253, 180, 7)'], // -10.5 -> -9.0 feet [0.333, 'rgb(253, 178, 109)'], // -9.0 -> -7.5 feet [0.444, 'rgb(253, 178, 109)'], // -9.0 -> -7.5 feet [0.444, 'rgb(253, 105, 9)'], // -7.5 -> 6.0 feet [0.555, 'rgb(253, 105, 9)'], // -7.5 -> 6.0 feet [0.555, 'rgb(254, 140, 108)'], // -6.0 -> -4.5 feet [0.666, 'rgb(254, 140,
🌐
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…
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-plotly-how-to-set-up-a-color-palette
Python Plotly - How to set up a color palette? - GeeksforGeeks
July 23, 2025 - In Plotly a color palette is a set of colors that you can use to make your plots look more attractive. You can set up a color palette to control how the colors in your graph.
Top answer
1 of 2
35

Generally, changing the color scheme for a plotly express figure is very straight-forward. What's causing the problems here is the fact that species is a categorical variable. Continuous or numerical values are actually easier, but we'll get to that in a bit.

For categorical values, using color_discrete_map is a perfectly valid, albeit cumbersome approach. I prefer using the keyword argument continuous_colorscale in combination with px.colors.qualitative.Antique, where Antique can be changed to any of the discrete color schemes available in plotly express. Just run dir(px.colors.qualitative) to see what are available to you in the plotly version you are running:

['Alphabet',
 'Antique',
 'Bold',
 'D3',
 'Dark2',
 'Dark24',
 'G10',......]

Code 1:

import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length",
                 color="species", color_discrete_sequence=px.colors.qualitative.Antique)

fig.show()

Plot 1:

So what about continuous variables?

Consider the following snippet:

import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length",
                 color="sepal_length", color_continuous_scale=px.colors.sequential.Viridis)

fig.show()

Running this will produce this plot:

You can change the colors to any other theme available under dir(px.colors.sequential), for example color_continuous_scale=px.colors.sequential.Inferno, and get this plot:

What's possibly causing confusion here, is that setting color='species, and keeping color_continuous_scale=px.colors.sequential.Inferno will give you this plot:

The figure now jumps straight back to using the default plotly colors, without giving you any warning about color_continuous_scale=px.colors.sequential.Inferno not having an effect. This is because species is a categorical variable with these different values : ['setosa', 'versicolor', 'virginica'], so color_continuous_scale is simply ignored. For color_continuous_scale to take effect you'll have to use a numerical value, like sepal_length = [5.1, 4.9, 4.7, 4.6, 5. , 5.4, ...]

And this brings us right back to my initial answer for categorical values:

Use the keyword argument continuous_colorscale in combination with px.colors.qualitative

2 of 2
20

You can use a method called color_discrete_map, which is a dict of k,v pairs where the k is the value for the color and v is the colorscheme. For example:

fig = px.scatter(df, x='sepal_length', y='sepal_width',
              color='species', color_discrete_map={'setosa': 'lightcyan', 
                                                   'versicolor': 'royalblue', 'virginica': 'darkblue'})

🌐
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 › python-api-reference › generated › plotly.express.colors.html
plotly.express.colors package — 7.1.0 documentation
Interpolates between colors in a colorscale to find the specific colors corresponding to the specified sample values. The colorscale can be specified as a list of [scale, color] pairs, as a list of colors, or as a named plotly colorscale.
🌐
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.
🌐
Plotly
plotly.net › reference › plotly-net-styleparam-colorscale.html
Colorscale (Plotly.NET) | Plotly.NET
The colorscale must be a collection containing a mapping of a normalized value (between 0.0 and 1.0) to it's color.
🌐
Plotly
plotly.github.io › plotly.py-docs › generated › plotly.graph_objects.Heatmap.html
plotly.graph_objects.Heatmap — 7.0.0 documentation
colorbar – plotly.graph_objects.heatmap.ColorBar instance or dict with compatible properties · colorscale – Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsla, hwb, or named color string.