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
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
Hi,
I am trying to plot a 2D array which contains some NaN values as a map. I
would like to be able to control the colours assigned to these data points.
At the moment it seems that there are given the same colour as the highest
value in the array. Any suggestions would be appreciated. Although n