Color scale in contour marks

It seems that the domain for the color channel for contour plot is always symmetric around zero, regardless of the extent of the data plotted? See this notebook:

where there are no blue colors since the color scale runs up to nearly 20000, but the maximal value is -337. How can I make the darkest blue equal to -337? domain in the color channel does not help.

Thanks!

try adding this option in the color specification:

symmetric: false,
1 Like

That does not work unfortunately. It changes the number scale on the colorbar, but not the actual color scale.

You can see that the scale is different by applying it to a number, for instance:

pltmean.scale("color").apply(10)

the color is different when you add the symmetric option. But maybe there are no contour with a blue value?

Thanks a lot for the help! There must be some misunderstanding on my part, but I donโ€™t understand why the higher end of the color scale (darkest blue) does not align with the maximum in my data. I would have thought that I could at least use the domain for the color channel to control this. Which is the way it works here: Scales | Observable Plot

Setting type: โ€œlogโ€ in the color channel gives something usable, so I going with that now.

Thanks for the help!

I think the misunderstanding is on me: I thought the domain was both negative and positive numbers, with different orders of magnitude. If they are all the same sign, a diverging scale can work but needs to be given a pivot (which will then correspond to the center color, say the yellow in RdYlBu). (You can also use a diverging color scheme (such as RdYlBu) with a logarithmic scale.)

1 Like

Ok, I see! Thanks, I will mark this as solved now. Thank you for the quick response!