python plot大尺寸数据

时间:2016-05-03 22:46:53

标签: python matplotlib

我有一个1800 * 100000000矩阵,我想使用下面的代码在python中绘制它:

import matplotlib.pyplot as plt
plt.spy(m)
plt.show()

结果令人失望,它看起来像一条线,因为与列号相比,行数很少:

enter image description here

我该如何正确地做到这一点?

1 个答案:

答案 0 :(得分:1)

spy() accepts a number of keyword arguments, aspect in particular is interesting...

In [1]: import numpy as np
In [2]: import matplotlib.pyplot as plt
In [3]: a = np.random.random((25,250))>0.6
In [4]: %matplotlib
Using matplotlib backend: Qt4Agg
In [5]: plt.spy(a)
Out[5]: <matplotlib.image.AxesImage at 0x7f9ad1a790b8>

standard

In [6]: plt.spy(a, aspect='auto')
Out[6]: <matplotlib.image.AxesImage at 0x7f9ad1139d30>

enter image description here