I am trying to plot an array full of ones and zeros and most of the time it works well and looks like this.
However, when my array becomes too big (I need to plot 60,000x70) the plot only draws part of the data.
At first I thought that this might be some sort of memory issue, but the arrays actually are not that big after all and when looking into memory usage there also was no sign of too heavy lifting.
It becomes really weird, however, when I plot the transposed array, because then it works like a breeze.
I looked around in forums quite a lot but apparently nobody else has had such an issue. Might this be a bug? I really need to plot it in the original orientation. So, any help is highly appreciated. Thanks in advance!
UPDATE
This exactly reproduces my problem:
import numpy as np
import matplotlib.pyplot as plt
# generate fake data
a = np.random.random((60000, 70))
for x in np.nditer(a, op_flags=['readwrite']):
if x > 0.9:
x[...] = 1
else:
x[...] = 0
# plot fake data
fig, axes = plt.subplots(2, 2)
axes[0][0].imshow(a, interpolation='none', cmap='binary', aspect='auto')
axes[0][1].imshow(a.T, interpolation='none', cmap='binary', aspect='auto')
axes[1][0].imshow(a[:30000], interpolation='none', cmap='binary', aspect='auto')
axes[1][1].imshow(a[:30000].T, interpolation='none', cmap='binary', aspect='auto')
plt.show()
The code yields this. In the upper left subplot everything is plotted. In the plot showing the transposed array (upper right), however, matplotlib only draws the first ~10000 columns. The lower two plots just show the first half of the array (left normal, right transposed) and as you can see, with smaller arrays there is no issue.
SOLVED
This problem does not occur with matplotlib 2.x
a? Why is there a pandas tag on this question? How is pandas involved? (Transposing DataFrames can change its columns' dtypes...)