Re: [Matplotlib-users] Controlling colours for NaN values with basemap

2009-09-25 Thread mdekauwe
Note palette.set_bad ('w',1.0) # Bad values (i.e., masked, set to white!) mdekauwe wrote: > > Problem solved thanks to Jose. > > For interest... > > import numpy as np > import matplotlib.pyplot as plt > a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]]) > palette = plt.cm.jet > palette.set

Re: [Matplotlib-users] Controlling colours for NaN values with basemap

2009-09-25 Thread mdekauwe
Problem solved thanks to Jose. For interest... import numpy as np import matplotlib.pyplot as plt a = np.array([[1,2,3,np.nan,5],[4,22,np.nan,11,9]]) palette = plt.cm.jet palette.set_bad ('w',1.0) # Bad values (i.e., masked, set to grey 0.8 A = np.ma.array ( a, mask=np.isnan(a)) plt.imshow(A,int