Surface 3D configure colorscale based on values


#1

Hi,

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 ?

Regards,


#2

See:

for some examples.


#3

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.


#4

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

More info:


#5

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


#6

You mean from

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

?

in that case

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

should do the trick.