# Colorscale - Not able to reproduce correct output

**URL:** <https://community.plotly.com/t/colorscale-not-able-to-reproduce-correct-output/1887>\
**Category:** plotly.js\
**Created:** [August 18, 2016, 1:58pm UTC](https://community.plotly.com/t/colorscale-not-able-to-reproduce-correct-output/1887 "2016-08-18T13:58:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rudi8292](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@rudi8292](https://community.plotly.com/u/rudi8292)\
**Post date:** [August 18, 2016, 1:58pm UTC](https://community.plotly.com/t/colorscale-not-able-to-reproduce-correct-output/1887/1 "2016-08-18T13:58:46Z")

</div>

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**

 ![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/1X/c0dd7fb69e962b74f8d433aacac0781ac4a72a8d.png)

```
            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.

 ![](https://us1.discourse-cdn.com/flex024/uploads/plot/original/1X/9c33439dd7503320132d75600b9cebc166391b99.png)  
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](https://gist.github.com/Rudresh-Ajgaonkar/72d0ce6c60bccba751a4bd0f81c12674))

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![rudi8292](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@rudi8292](https://community.plotly.com/u/rudi8292)\
**Post date:** [August 18, 2016, 2:39pm UTC](https://community.plotly.com/t/colorscale-not-able-to-reproduce-correct-output/1887/2 "2016-08-18T14:39:12Z")

</div>

@etienne can you help with this ?

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [August 19, 2016, 9:13pm UTC](https://community.plotly.com/t/colorscale-not-able-to-reproduce-correct-output/1887/3 "2016-08-19T21:13:42Z")

</div>

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