title: Matplotlib imshow colormap not covering full dynamic range of data
body: <p>I'm trying to produce colormaps of <code>numpy</code> arrays with large dynamic ranges. To that end, I've tried using <code>imshow</code> from <code>matplotlib.pyplot</code>, but there appears to be a problem with the colormap. </p>
  
  <p>Specifically, every value in the array below a certain threshold is plotted as the same color as the minimum value in the array.</p>
  
  <p>Below is a minimal working example. I produce an array containing values from 1e-4 to 1e+20, but in <code>imshow</code> all cells containing values less than 1e+3 appear to be set equal to 1e-4. However, there is no such issue using <code>pcolormesh</code>.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  from matplotlib.colors import LogNorm
  import numpy as np
  
  # 2d (5x5) array with large dynamic range: 1e-4, 1e-3, ..., 1e+20
  a = np.logspace(-4, 20, num=25).reshape(5, 5)
  
  # imshow producing wrong image
  fig = plt.figure()
  plt.imshow(a, norm=LogNorm(), origin='lower')
  plt.colorbar()
  fig.savefig("imshow_broken.png")
  
  # pcolormesh producing correct image
  fig = plt.figure()
  plt.pcolormesh(a, norm=LogNorm())
  plt.colorbar()
  fig.savefig("pcolormesh_working.png")
  </code></pre>
  
  <p>I'm using <code>matplotlib</code> version 2.1.2, but the problem seems to disappear on older versions, e.g. 1.5.3, perhaps suggesting a bug in recent <code>matplotlib</code> versions.</p>
  
  <p><code>imshow</code>:
  <a href="https://i.stack.imgur.com/IqmxA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IqmxA.jpg" alt="imshow_broken"></a></p>
  
  <p><code>pcolormesh</code>:
  <a href="https://i.stack.imgur.com/NXwFy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NXwFy.jpg" alt="pcolormesh_working"></a></p>