<p dir="auto">I'm witnessing a behavior that seems like a bug when using <code class="notranslate">imshow()</code> with the interpolation flag. Consider this example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from matplotlib import pyplot as plt
W=np.random.randn(200,200)
plt.imshow(W, interpolation='bicubic', cmap='seismic', vmin=-3, vmax=3)"><pre class="notranslate"><code class="notranslate">from matplotlib import pyplot as plt
W=np.random.randn(200,200)
plt.imshow(W, interpolation='bicubic', cmap='seismic', vmin=-3, vmax=3)
</code></pre></div>
<p dir="auto">This results in the following image:</p>
<p dir="auto"><a href="https://i.stack.imgur.com/vp59j.png" rel="nofollow"><img src="https://camo.githubusercontent.com/d654c32a69c5892768f373427d324ec38abf34bc41c74dbcc489913097e10b3d/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f767035396a2e706e67" alt="enter image description here" data-canonical-src="https://i.stack.imgur.com/vp59j.png" style="max-width: 100%;"></a></p>
<p dir="auto">Obviously I did not expect the squares to be there. This issue also happens with the option <code class="notranslate">bilinear</code>, <code class="notranslate">gaussian</code>, <code class="notranslate">bessel</code> and pretty much every other interpolation that I tested that isn't <code class="notranslate">nearest</code>.</p>
<p dir="auto">Here's the output of the <code class="notranslate">nearest</code> option, just for comparison:</p>
<p dir="auto"><a href="https://i.stack.imgur.com/X9T2b.png" rel="nofollow"><img src="https://camo.githubusercontent.com/6809d4dca29164e1a4e1b136328b3e25a762122e3661405d17b28bfb23386b96/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f58395432622e706e67" alt="enter image description here" data-canonical-src="https://i.stack.imgur.com/X9T2b.png" style="max-width: 100%;"></a></p>
<p dir="auto">So this is weird in that the squares are larger than a "data pixel". I don't know what's causing this. The squares apparently pop where the value is larger/smaller than <code class="notranslate">vmax</code>/<code class="notranslate">vmin</code>, but that's about all I know.</p>
<p dir="auto">Some notes:</p>
<ul dir="auto">
<li>If I don't set <code class="notranslate">vmin</code> and <code class="notranslate">vmax</code> this effect doesn't happen.</li>
<li>I'm using version 2.0.2 of <code class="notranslate">matplotlib</code></li>
<li>This issue happens in Python 3.4 and 3.5 and Python 2.7 with said version of <code class="notranslate">matplotlib</code></li>
<li>Doesn't appear to affect Python 2.7 and <code class="notranslate">matplotlib</code> 2.0.0</li>
</ul>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">With imshow(), image interpolation gives wrong results near pixels with values exceeding vmax. A large rectangular region (given by the interpolation kernel size) is filled with color corresponding to maximum value.</p>

<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="t = zeros((50, 50))
t[10, 10] = 1
t[10, 20] = 2
imshow(t, vmin=0, vmax=1, interpolation='lanczos')"><pre class="notranslate"><span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-en">zeros</span>((<span class="pl-c1">50</span>, <span class="pl-c1">50</span>))
<span class="pl-s1">t</span>[<span class="pl-c1">10</span>, <span class="pl-c1">10</span>] <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-s1">t</span>[<span class="pl-c1">10</span>, <span class="pl-c1">20</span>] <span class="pl-c1">=</span> <span class="pl-c1">2</span>
<span class="pl-en">imshow</span>(<span class="pl-s1">t</span>, <span class="pl-s1">vmin</span><span class="pl-c1">=</span><span class="pl-c1">0</span>, <span class="pl-s1">vmax</span><span class="pl-c1">=</span><span class="pl-c1">1</span>, <span class="pl-s1">interpolation</span><span class="pl-c1">=</span><span class="pl-s">'lanczos'</span>)</pre></div>
<p dir="auto"><a href="https://gist.github.com/geggo/b40da1b69b2a1cd37f8a8454423d3495">see gist</a></p>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/968371/26103864/b0f02152-3a3b-11e7-8ba2-ba793a9a1be9.png"><img width="253" alt="download 2" src="https://cloud.githubusercontent.com/assets/968371/26103864/b0f02152-3a3b-11e7-8ba2-ba793a9a1be9.png" style="max-width: 100%;"></a></p>

<p dir="auto"><strong>Expected outcome</strong></p>


<p dir="auto">Ok with matplotlib 2.0.0</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/968371/26103723/2271b1de-3a3b-11e7-9497-501d50a59101.png"><img width="253" alt="download" src="https://cloud.githubusercontent.com/assets/968371/26103723/2271b1de-3a3b-11e7-9497-501d50a59101.png" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating System: macOS</li>
<li>Matplotlib Version: 2.0.1, 2.0.2</li>
<li>Python Version: 2.7</li>
<li>Jupyter Version (if applicable):</li>
<li>Other Libraries:</li>
</ul>


<p dir="auto">matplotlib installed via conda-forge</p>