Closed
Description
Bug report
Bug summary
Hello, I am using plt.imshow
to plot a very large array (~ 1 row x 150 million columns), and have noticed that the colors are not displayed properly.
Code for reproduction
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)
Expected outcome
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.
Matplotlib version
- Operating system: Ubuntu 20.04
- Matplotlib version: 3.3.2 (also tested on 3.3.3)
- Matplotlib backend: module://ipykernel.pylab.backend_inline
- Python version: 3.8.3 (also tested on 3.6.9)
- Jupyter version (if applicable):
- Other libraries:
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
Python installed via miniconda, but matplotlib was installed via pip.