为什么plt.imshow不显示numpy数组中存储的所有像素?

时间:2019-06-27 16:25:42

标签: python matplotlib

我正在尝试绘制一些神经数据的栅格图。我在3500个时间点矩阵上进行了30次试用,其中0表示没有活动,而1表示峰值。

我尝试使用plt.imshow创建矩阵的图像,但是,它不能显示所有尖峰。

这是我的代码:

# Loading data
V1Orientation = sio.loadmat('V1Orientation.mat')
spikes = V1Orientation['spikes']
raster = spikes[1,:,:].T

np.shape(raster)
#(30,3500)

# Visualizing results
plt.figure()
plt.imshow(raster, aspect='auto')

期望的输出将是显示每个像素值为1的图像,但是,该图像仅显示其中几个值。

例如,栅格矩阵的第一行具有15个非零(峰值),但所得图像仅显示2个非零像素。如何修复代码以表示数据中的所有非零值,而不仅仅是少数?

这是代码的输出图像:

Raster plot

0 个答案:

没有答案