Color Scale - Close But Not Close Enough
I'm trying to produce a plot which uses the same colorscale as the Met Office, so I can easily compare my plots to theirs. An example of theirs is at Here My current closest effort
Solution 1:
If the issue is simply the colormap, you can pick the RGB components of the colors off your screen and turn them into a ListedColormap
, mapped to the boundaries of the rainfall in the chart you give as an example. For example,
bounds = [0, 40, 60, 80, 100, 125, 150, 200, 250, 1000]
rgblist = [(51,0,0), (102,51,0), (153,102,51), (204,153,102), (255, 255, 255),
(204,204,255), (153,153,255), (51,102,255), (0,0,153)]
clist = [[c/255 for c in rgb] for rgb in rgblist]
from matplotlib import colors
cmap = colors.ListedColormap(clist)
norm = colors.BoundaryNorm(bounds, cmap.N)
ax.imshow(arr, cmap=cmap, norm=norm)
plt.show()
Solution 2:
The first part (getting the colors right) was already answered. In order to restrict the values to a certain range you have several options.
Post a Comment for "Color Scale - Close But Not Close Enough"