I have the following problem, the color palettes that matplotlib
brings are predetermined, and I am making the following graphic:
import pylab as plt
import pandas as pd
import numpy as np
fig = plt.figure()
x1 = np.arange(1,13,1)
y1 = np.arange(0,24,1)
lev = np.arange(0,5,1)
X,Y = np.meshgrid(x1,y1)
cs = plt.contourf(X,Y,z,lev[lev !=0], cmap= 'bwr' ,extend='both', alpha=0.5, )
plt.colorbar(cs, orientation = 'vertical',ticks = lev)
plt.quiver(X,Y,a,b)
plt.show()
what generates a graphic like this:
I need the blue part to be white is to say that values less than 2 are white and the largest red, it would be like having a color that goes from white to red, a sequential color but only 2 shades in this case white and red, my question is if there is a way to create a divergent color with those characteristics or if only the default ones can be used. Thanks in advance.