I draw some geoplots using cartopy. Using Two Slope Normalisation and “RdBu_r” colormap to plot air temperature field.
color_map = 'RdBu_r'
fig = plt.figure(figsize=(16, 12))
ax = plt.axes(projection=prj)
norm = TwoSlopeNorm(vmin=np.min(data), vcenter=273.15, vmax=np.max(data))
filled_contour = ax.contourf(data['longitude'], data['latitude'], data, norm=norm, levels=15, transform=ccrs.PlateCarree(), cmap=color_map, extend='both')
isotherm_0 = ax.contour(data['longitude'], data['latitude'], data, levels=[273.15], colors='green', transform=ccrs.PlateCarree(), linewidths=0.5, linestyles='dashed')
I perform normalization in order to cover negative temperatures with blue shades, and positive temperatures with red shades. If the dataset contains a wide range of negative and positive temperatures, the geoplot seems to be fine:
But if there are a lot of positive temperatures and a small amount of slightly negative ones, the map will not be built as expected:
In the image you can see how slightly negative temperatures (the minimum is 272.6236 K) are painted in dark blue shade (extreme blue value for the colormap), instead of light blue as for temperatures slightly below zero.
When I draw a geoplot zoomed in to this negative temperatures area, I also get a nice image with proper spread of color shades:
Why are the colors not drawn correctly in case as of Pic 2? How can I avoid this?