I found the solution here Continuous color scales and color bars in Python Answer from Kansai on community.plotly.com
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 › colorscales
Continuous color scales and color bars in Python
Color scale defaults depend on ... 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 ...
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 - Below I've taken a part of the ... build a custom colour scale based off of this data. The elevations legend shows a minimum and maximum elevation given in feet and the colour which should represent a data point in this range. Following the Plotly.js scatter colorscale reference ...
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
community.plotly.com › dash python
Dash Newbie - Heatmap Custom Color Scales Per Column - Dash Python - Plotly Community Forum
April 30, 2023 - Hello, found this forum from the book “The Book Of Dash” and I’m hopeful someone can assist me on this problem. I’ve managed to stumble through a few examples and create my own annotated heatmap, reading in data from .csv files and all, but I don’t like the built-in colorscale.
Plotly
plotly.com › fsharp › colorscales
Continuous color scales and color bars in Fsharp
let z = [| [| 10.0; 10.625; 12.5; 15.625; 20.0 |] [| 5.625; 6.25; 8.125; 11.25; 15.625 |] [| 2.5; 3.125; 5.0; 8.125; 12.5 |] [| 0.625; 1.25; 3.125; 6.25; 10.625 |] [| 0.0; 0.625; 2.5; 5.625; 10.0 |] |] //let customColorscale = StyleParam.Colorscale.Custom [(0.0,"#A6CEE3");(1.0,"#E31A1C")] let customColorscale = StyleParam.Colorscale.Custom [ (0.0, "rgb(166,206,227)") (0.25, "rgb(31,120,180)") (0.45, "rgb(178,223,138)") (0.65, "rgb(51,160,44)") (0.85, "rgb(251,154,153)") (1.0, "rgb(227,26,28)") ] Chart.Contour(z,Colorscale=customColorscale) |> Chart.withSize(600.,600.) Out[8]: Like axes, you ca
Plotly
community.plotly.com › 📊 plotly python
How to customize the color_continuous_scale in plotly? - 📊 Plotly Python - Plotly Community Forum
March 8, 2022 - 我想用plotly的热力图强调某个区间数据, 比如:下图,我想让显示黄色的取值区间为146-317, 或者说当取值范围在146-317时显示黄色,我该咋做呢? I want to use plotly’s heat map to emphasize a certain range of data, for example: in the figure below, I want to display the value range of yellow as 146-317, or display yellow when the value range is 146-317, what should I do?
Plotly
community.plotly.com › 📊 plotly python
Treemap Custom scale color scale - 📊 Plotly Python - Plotly Community Forum
April 29, 2021 - Hi Everyone, I am new in Dash and Plotly environnement, great tools ! I am currently working on Treemap. So far I successfully read my excel, extract data and buil a hierarchical dataframe to be read by plotly Treemap ( go.Treemap). I am now struggling to create a custom colorscale based on a custom scale.
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 ) )
Plotly
community.plotly.com › plotly.js
Custom Color Scale for Scatter Chart - plotly.js - Plotly Community Forum
November 4, 2021 - I have a scatter plot with multiple series as such: let scatterPlot = { x: scatterData.map((a) => a.x), y: scatterData.map((a) => a.y), name: data.seriesName, type: 'scattergl', mode: 'markers', marker: { color: scatterData.map((a) => a.color), size: scatterData.map((a) => a.size), }, }; As you can see, the color for each marker poi...
Plotly
plotly.com › fsharp › logarithmic-color-scale
Continuous Color Scales and Color Bars | Fsharp | Plotly
open FSharp.Data type jsondata = JsonProvider<"https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json"> let data = jsondata.Load("https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json") In [10]: let z = data.Z //let customColorscale = StyleParam.Colorscale.Custom [(0.0,"#A6CEE3");(1.0,"#E31A1C")] let customColorscale = StyleParam.Colorscale.Custom [(0.0,"rgb(165,0,38)");(0.11,"rgb(215,48,39)");(0.22,"rgb(244,109,67)"); (0.33,"rgb(253,174,97)");(0.44,"rgb(254,224,144)");(0.55,"rgb(224,243,248)"); (0.66,"rgb(171,217,233)");(0.77,
Notebook Community
notebook.community › empet › Plotly-plots › Plotly-asymmetric-colorscales
Plotly asymmetric diverging colorscales adapted to data
The resulted financial-type colorscale is represented by the following list: ... fin_cs=[[0.0, u'#df0101'], [0.1, u'#e33129'], [0.2, u'#e86353'], [0.3, u'#ec937b'], [0.4, u'#f1c5a5'], [0.5, u'#f4f6cd'], [0.6, u'#cee9a6'], [0.7, u'#a6db7c'], [0.8, u'#7fce55'], [0.9, u'#57c12c'], [1.0, u'#31b404']] Seaborn provides a function for defining custom diverging matplotlib colormaps, that can be transformed in Plotly colorscales:
Top answer 1 of 3
5
trace0 = go.Scatter(
x = foo,
y = bar,
name = 'baz',
line = dict(
color = ('rgb(6, 12, 24)'),
width = 4)
)
This allows you to change the color of the line or you could use
colors = `['rgb(67,67,67)', 'rgb(115,115,115)', 'rgb(49,130,189)', 'rgb(189,189,189)']`
for separate lines of a graph. To use the specified color gradient try
data = [
go.Scatter(
y=[1, 1, 1, 1, 1],
marker=dict(
size=12,
cmax=4,
cmin=0,
color=[0, 1, 2, 3, 4],
colorbar=dict(
title='Colorbar'
),
colorscale='Viridis'
),
mode='markers')
]
2 of 3
1
Found an answer to my problem:
import plotly.plotly as py
import cufflinks as cf
from bokeh.palettes import viridis
cf.set_config_file(offline=True, world_readable=True, theme='white')
colors = viridis(4)
df = pd.DataFrame(np.random.rand(10, 4), columns=['A', 'B', 'C', 'D'])
fig = df.iplot(kind='bar', barmode='stack',asFigure = True)
for i,color in enumerate(colors):
fig['data'][i]['marker'].update({'color': color})
fig['data'][i]['marker']['line'].update({'color': color})
py.offline.iplot(fig)




