✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Colorscale - Not able to reproduce correct output

I have a surface plot which passes through scatter points.
I have colored the surface according to categories. The following is the output of using matplotlib

            colormap = {'a' : 0, 'b' : 0.16666667, 'c' : 0.33333333, 'd': 0.5 , 'e' : 0.66666667, 'f': 0.83333333, 'g' : 1 }

           cmap = colors.ListedColormap(['#ffa500', '#ff0000', '#ffff00','#343434','#0000ff','#001e00','#006400'])

When i try to use a similar color scale using plotly, i get different results.


0
I have used the following colorscale :

colorscale: [
// # Let first 10% (0.1) of the values have color rgb(0, 0, 0)
[0, ‘rgb(255, 0, 0)’], //red
[0.1666666666, ‘rgb(255, 0, 0)’],

                // # Let values between 10-20% of the min and max of z
                // # have color rgb(20, 20, 20)
                [0.1666666666, 'rgb(255, 165, 0)'],
                [0.33333333, 'rgb(255, 165, 0)'],

                // # Values between 20-30% of the min and max of z
                // # have color rgb(40, 40, 40)
                [0.33333333, 'rgb(255, 255, 0)'],
                [0.5, 'rgb(255, 255, 0)'],

                [0.5, 'rgb(128, 128, 128)'],
                [0.6666666, 'rgb(128, 128, 128)'],

                [0.6666666, 'rgb(0, 128, 0)'],
                [0.8333333, 'rgb(0, 128, 0)'],

                 [0.83333333, 'rgb(0, 255, 223)'],
                 [1, 'rgb(0, 255, 223)'],

Is there additional that is to be taken care of while using the colorscale option?

Here is the Surfacecolor data that i am using (https://gist.github.com/Rudresh-Ajgaonkar/72d0ce6c60bccba751a4bd0f81c12674)

Thanks in Advance.

@etienne can you help with this ?

It’s a little hard to help here without a reproducible example. Would you mind sharing the data you used to generate your graph?