-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colormap for difference or anomaly field needs adjustment #246
Comments
@lee1043 I think this is because by default getcolors splits the color range (0,255) in two halves and use the first half for negative values and the second half for positive values, as the result you're right the colors just before and just after zero are almost identical. import vcs
>>> levels = [-40, -30, -20, -10, 0, 10, 20, 30, 40]
>>> print vcs.getcolors(levels)
[0, 42, 85, 127, 128, 170, 213, 255] Note colors before and after 0 and 127 and 128. ALmost identical I'll revise the algorithm, for now please use >>> levels = [-40, -30, -20, -10, 0, 10, 20, 30, 40]
>>> print vcs.getcolors(levels,split=0)
[0, 36, 73, 109, 146, 182, 219, 255] since you have as many colors on each side of the 0 it doesn't matter. |
@doutriaux1 Thanks for solution. Curious what split is for and how it work. Also, above code does not work when I set levels as below, assign same color between -10 to 10. iso.levels = [-40, -30, -20, -10, 10, 20, 30, 40] #### This does not work Returning error message is:
Is there any constraints when I have 0 in levels? I checked this error does not happen when I use |
@lee1043 what? Let me try this. It should work. Can you point me to your code? |
|
@doutriaux1 Here is the code that returns error when level is not including 0 and split=0 is not being used. |
@lee1043 the test works for me. Which vcs are you using? |
|
When you see colorbar at range of [-10, 0] and [0, 10], you will see both colors are same. It looks like colors are somehow shifted by using 16, 240 range.
It is expected to have colorbar something like below. You will notify colors are contrasted at zero.
Below is a plotting code for above-most image.
The text was updated successfully, but these errors were encountered: