I've searched around for a while now and I am trying to customize the color scale by hex color code, but I could not find a valid way to do it. Is the default preset color sales the only option for us? This is for a map generated by plotly's mapbox API.
I have gone through their documentation here: https://plotly.com/python/styling-plotly-express/
Any comment or tips would be greatly appreciated!
Figured it out finally so I'll answer myself, setting a custom color scale like below then assigning it to the argument would work:
colorscale = [
[0, 'rgb(38, 53, 113)'],
[0.5, 'rgb(57, 162, 225)'],
[1, 'rgb(234, 32, 41)']
]
...and then in the argument:color_continuous_scale = colorscale
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.