<h3 dir="auto">Bug summary</h3>
<p dir="auto">2D arrays with more than about 8.000.000 columns are truncated on the right side.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
from matplotlib import pyplot

for length in range(6000000,10000000,500000):
    s = .5 * np.sin(np.linspace(0,6*np.pi,length))
    pyplot.plot(s)
    pyplot.imshow(s.reshape((1,len(s))),aspect='auto',cmap='seismic')
    pyplot.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">pyplot</span>

<span class="pl-k">for</span> <span class="pl-s1">length</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">6000000</span>,<span class="pl-c1">10000000</span>,<span class="pl-c1">500000</span>):
    <span class="pl-s1">s</span> <span class="pl-c1">=</span> <span class="pl-c1">.5</span> <span class="pl-c1">*</span> <span class="pl-s1">np</span>.<span class="pl-en">sin</span>(<span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>,<span class="pl-c1">6</span><span class="pl-c1">*</span><span class="pl-s1">np</span>.<span class="pl-s1">pi</span>,<span class="pl-s1">length</span>))
    <span class="pl-s1">pyplot</span>.<span class="pl-en">plot</span>(<span class="pl-s1">s</span>)
    <span class="pl-s1">pyplot</span>.<span class="pl-en">imshow</span>(<span class="pl-s1">s</span>.<span class="pl-en">reshape</span>((<span class="pl-c1">1</span>,<span class="pl-en">len</span>(<span class="pl-s1">s</span>))),<span class="pl-s1">aspect</span><span class="pl-c1">=</span><span class="pl-s">'auto'</span>,<span class="pl-s1">cmap</span><span class="pl-c1">=</span><span class="pl-s">'seismic'</span>)
    <span class="pl-s1">pyplot</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/20534033/227931365-bcabad57-5ec4-4591-8980-320da4740fea.png"><img src="https://user-images.githubusercontent.com/20534033/227931365-bcabad57-5ec4-4591-8980-320da4740fea.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Image truncated on the right if length &gt; 8000000.</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/20534033/227930731-4b3744d2-05d4-4a9e-9f0c-9beb4b5872f3.png"><img src="https://user-images.githubusercontent.com/20534033/227930731-4b3744d2-05d4-4a9e-9f0c-9beb4b5872f3.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Expected same outcome independent of length.</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows 10</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.1.0</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">module://ipykernel.pylab.backend_inline</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.7.3</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Hello, I am using <code class="notranslate">plt.imshow</code> to plot a very large array (~ 1 row x 150 million columns), and have noticed that the colors are not displayed properly.</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="import numpy as np
import matplotlib.pyplot as plt

# Very large
array = np.zeros(150000000, dtype=np.uint8)
array[len(array) // 2:] = 1
fig, ax = plt.subplots(figsize=(10, 3))
im = ax.imshow(array.reshape(1, -1), vmin=0, vmax=1, aspect='auto')
fig.colorbar(im, ax=ax)

# 10x smaller
array = np.zeros(15000000, dtype=np.uint8)
array[len(array) // 2:] = 1
fig, ax = plt.subplots(figsize=(10, 3))
im = ax.imshow(array.reshape(1, -1), vmin=0, vmax=1, aspect='auto')
fig.colorbar(im, ax=ax)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-c"># Very large</span>
<span class="pl-s1">array</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">zeros</span>(<span class="pl-c1">150000000</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-s1">uint8</span>)
<span class="pl-s1">array</span>[<span class="pl-en">len</span>(<span class="pl-s1">array</span>) <span class="pl-c1">//</span> <span class="pl-c1">2</span>:] <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">10</span>, <span class="pl-c1">3</span>))
<span class="pl-s1">im</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">imshow</span>(<span class="pl-s1">array</span>.<span class="pl-en">reshape</span>(<span class="pl-c1">1</span>, <span class="pl-c1">-</span><span class="pl-c1">1</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">aspect</span><span class="pl-c1">=</span><span class="pl-s">'auto'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">colorbar</span>(<span class="pl-s1">im</span>, <span class="pl-s1">ax</span><span class="pl-c1">=</span><span class="pl-s1">ax</span>)

<span class="pl-c"># 10x smaller</span>
<span class="pl-s1">array</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">zeros</span>(<span class="pl-c1">15000000</span>, <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">np</span>.<span class="pl-s1">uint8</span>)
<span class="pl-s1">array</span>[<span class="pl-en">len</span>(<span class="pl-s1">array</span>) <span class="pl-c1">//</span> <span class="pl-c1">2</span>:] <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">10</span>, <span class="pl-c1">3</span>))
<span class="pl-s1">im</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">imshow</span>(<span class="pl-s1">array</span>.<span class="pl-en">reshape</span>(<span class="pl-c1">1</span>, <span class="pl-c1">-</span><span class="pl-c1">1</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">aspect</span><span class="pl-c1">=</span><span class="pl-s">'auto'</span>)
<span class="pl-s1">fig</span>.<span class="pl-en">colorbar</span>(<span class="pl-s1">im</span>, <span class="pl-s1">ax</span><span class="pl-c1">=</span><span class="pl-s1">ax</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong><br>
Very large<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1281521/104198905-cd836c80-53f4-11eb-8b31-932a30da23db.png"><img src="https://user-images.githubusercontent.com/1281521/104198905-cd836c80-53f4-11eb-8b31-932a30da23db.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">10x smaller<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1281521/104198876-c4929b00-53f4-11eb-93ba-a1e6b45dcd54.png"><img src="https://user-images.githubusercontent.com/1281521/104198876-c4929b00-53f4-11eb-93ba-a1e6b45dcd54.png" alt="image" style="max-width: 100%;"></a></p>

<p dir="auto"><strong>Expected outcome</strong><br>
Since we set the later half of the array to 1 (and the rest is 0), we expect the image to change color at 75 million, but we see that all pixels are colored as 0.</p>


<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Ubuntu 20.04</li>
<li>Matplotlib version: 3.3.2 (also tested on 3.3.3)</li>
<li>Matplotlib backend: module://ipykernel.pylab.backend_inline</li>
<li>Python version: 3.8.3 (also tested on 3.6.9)</li>
<li>Jupyter version (if applicable):</li>
<li>Other libraries:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ipython                       7.18.1
ipython-genutils              0.2.0
jupyter                       1.0.0
jupyter-client                6.1.7
jupyter-console               6.2.0
jupyter-core                  4.6.3
jupyterlab                    2.2.8
jupyterlab-pygments           0.1.1
jupyterlab-server             1.2.0"><pre class="notranslate"><code class="notranslate">ipython                       7.18.1
ipython-genutils              0.2.0
jupyter                       1.0.0
jupyter-client                6.1.7
jupyter-console               6.2.0
jupyter-core                  4.6.3
jupyterlab                    2.2.8
jupyterlab-pygments           0.1.1
jupyterlab-server             1.2.0
</code></pre></div>
<p dir="auto">Python installed via miniconda, but matplotlib was installed via pip.</p>