Hello,
I am trying to create a color map that maps 18 colors across 50 levels. As an example let say I have three colors [r,g,b] and want everything between 1 an 2 to be r, 3 through 10 to be g, and 11 through 50 to be b. From what I can tell it does not seem to be possible. Currently this is what I have, but it does not seem to work as I assumed.
colorList = [[0.,0.,102./255.],[0,42./255.,217./255.],[0,110./255.,217./255.],[0,178./255.,217./255.],
[0,212./255.,212./255.],[0,217./255.,166./255.],[0,217./255.,0],[149./255.,217./255.,0],
[217./255.,217./255.,0],[217./255.,174./255.,0],[217./255.,131./255.,0],[217./255.,87./255.,0],
[217./255.,0,0],[174./255.,0,0],[140./255.,0,0],[135./255.,0,0],
[105./255.,0,0],[65./255.,0,0]]
levels = [1,2,3,4,5,6,7,8,9,10,12,15,20,25,30,35,40,50]
cmap = matplotlib.colors.ListedColormap(colorList, name = 'theColorMap', N = len(colorList))
...
m.contourf(x,y,z,cmap=cmap, levels=levels, extend='both')
If the levels array is continuous then it works as expected. With the above settings I get unexpected results, which includes 'ghost contour lines'. The data I am rendering is from a GRIB file from NOAA.
Is this possible?
Thanks,
Steve