I am trying to figure out as much data visualization tools as I can from 2D matrices (bonus points to any other good methods for looking at 2D matrices).
I generate a lot of heatmaps, where I've been told pcolor
is the way to go (I now use seaborn
).
Why is plt.imshow
SO much quicker than plt.pcolor
when they are doing really similar operations?
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