matplotlib - Python 2-D Histogram with Discrete Colormap -


i have following code plots points , plots histogram:

# produce number of points in x-y 1 distribution.  mean = [3,4] cov = [[3,1],[1,3]]  x,y = np.random.multivariate_normal(mean,cov,1000).t plt.plot(x,y,'x'); plt.axis('equal'); plt.show() z = np.array([x,y])  # produce 2d histogram projection h,xedges,yedges = np.histogram2d(x,y,10,normed=false) x,y = np.meshgrid(xedges,yedges) plt.imshow(h) plt.grid(true) 

i want histogram on imshow() blockier instead of fuzzy density @ each square bin clearer. i'm not sure how that.

you can set interpolation method imshow uses:

plt.imshow(h, interpolation = 'none') 

here's an example showing different interpolation methods, , the docs list implemented methods.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -