I have plotted some data using matplotlib's imshow. I have also managed to combine three different colormaps for the plot (see figure), but I want the greens to go from 0-1000, the yellow/orange to go from 1000-1600 and reds from 1600 and up. It's almost correct out of the box, but not entirely. Anyone know how I can accomplish this?
colors1 = plt.cm.Greens_r(np.linspace(0, 0.4, 256))
colors2 = plt.cm.Oranges(np.linspace(0.1, 0.5, 256))
colors3 = plt.cm.Reds(np.linspace(0.6, 1, 256))
cmap = np.vstack((colors1, colors2, colors3))
cmap_test = colors.LinearSegmentedColormap.from_list('colormap', cmap)
fig, ax = plt.subplots()
plt.imshow(z, origin='upper', cmap=cmap_test, interpolation='none', extent=[0,25,5,-20])
cbar = plt.colorbar()
ax.grid(linestyle='-')
plt.show()