cong liu
cong liu

Reputation: 33

change the python matplotlib colormap dynamic range for certain range

I have created a 2D gaussian function for display, the variable gauss (below) is in range of (0, 1). what I want to do is change the default colormap dynamic range from (black, white) to (gray, white)

gauss = np.exp( -(((Xm**2)+(Ym**2)) / (2.0* s**2)) )
p=plt.imshow(gauss, 'Greys_r')

Upvotes: 1

Views: 2921

Answers (1)

Saullo G. P. Castro
Saullo G. P. Castro

Reputation: 58865

You can use the color maps Greys_r in conjunction with the parameters vmin=0.25 and vmax=1..

from matplotlib import cm

p = plt.imshow(gauss, cmap=cm.Greys_r, vmin=025, vmax=1.)

Upvotes: 2

Related Questions