2
我想从2D矩阵中找出尽可能多的数据可视化工具(对于查看2D矩阵的任何其他好方法都是额外的)。为什么plt.imshow比plt.pcolor快得多?
我生成了很多热点地图,我被告知pcolor
是要走的路(我现在使用seaborn
)。
为什么plt.imshow
比plt.pcolor
要快得多?
def image_gradient(m,n):
"""
Create image arrays
"""
A_m = np.arange(m)[:, None]
A_n = np.arange(n)[None, :]
return(A_m.astype(np.float)+A_n.astype(np.float))
A_100x100 = image_gradient(m,n)
%timeit plt.pcolor(A_100x100)
%timeit plt.imshow(A_100x100)
1 loop, best of 3: 636 ms per loop
1000 loops, best of 3: 1.4 ms per loop
可能存在重复的问题?参见:http://stackoverflow.com/questions/7470288/matplotlib-pcolor-very-slow-alternatives – Alejandro