Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Surface 3D configure colorscale based on values


I want to define colorscale of my 3D surface plot based on z-axis values.
for example, I want points with z-axis value < -10 in red color, points with z-axis value between - 10 and 10 in green and point with z-axis value >10 in blue.

Is it possible to do that ?



for some examples.

All I want is to do something like this
colorscale: [
[’-10’, ‘rgb(255, 0, 0)’],
[‘0’, ‘rgb(0, 0, 255)’],
[‘10’, ‘rgb(102, 0, 153)’]

ColorScale will be depending on zaxis but I want to specify values (like in the example above) not percentage.

Colorscale values must be between 0 and 1. Use cmin: -10 and cmax: 10 to set the bound in data space.

More info:

I see that cmin and cmax have been removed from data in version 1.43.0. Is there any substitution ?

You mean from

var gd = document.getElementById(/* id of your graph */)[0].cmin


in that case

var gd = document.getElementById(/* id of your graph */)

should do the trick.