1

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')

1 Answer 1

2

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.)
Sign up to request clarification or add additional context in comments.

2 Comments

3Q, but I want to shrink the range rather than invert it.
^_^, have checked. I'm new to stack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.