Why colour not showing in custom contour plot

Hi all,
Thank you for this forum, It’s very useful.
I’m trying to set custom contour levels as seen in some posts here.
I want limits of contours to be these fixed values: 0-500-1500-3000-10000-30000-150000
To build the colorscale I divide these values by the maximum value of data I have (31000 in the example below). That is to say:

Plotly.newPlot("graph", [
  {
    type: "contour",
    z: [[400, 400,2000, 2500], [7000, 20000,2000, 31000],[1200, 1200, 2000, 2500]],
    colorscale: [
      [0, 'rgb(204, 255, 204)'], [0.01612903225, 'rgb(153, 204, 51)'], [0.04838709677, 'rgb(51, 153, 102)'], [0.09677419354, 'rgb(255, 153, 51)'], [0.32258064516, 'rgb(250, 135, 135)'], [1, 'rgb(255, 0, 0)']
      ]
    
  }
]);

But… I don’t know why some colours don’t appear. I would really appreciate help because I have tried many configurations and none of them worked. I don’t know if it is impossible to do it or there is some error in my code.

Kindly advice,

Using the ‘ncontours’ It was fixed

1 Like