Does this work?
from matplotlib import colors, cm, pyplot as plt
norm = colors.LogNorm(image.mean() + 0.5 * image.std(), image.max(), clip='True')
plt.imshow(image, cmap=cm.gray, norm=norm, origin="lower")
This creates a special colormap that ranges from image.mean() + 0.5 * image.std()
to image.max()
using a logarithmic scale. More general information is here: colors
and specifically: LogNorm
The origin='lower'
means that the [0,0]
element (the 'origin') of the array is shown in the lower left part of the figure. Normally the origin of an array is in the upper left.