smoothing imshow plot with matplotlib [duplicate]

≡放荡痞女 提交于 2019-12-02 07:26:35

Try using the interpolation argument: ax.imshow(grid, interpolation=interp_method)

matplotlib demo

matplotlib api

If you manually want to handle how strong the filter is you could do something along the lines of (scipy.ndimage has a lot of filters)

from scipy.ndimage.filters import gaussian_filter
arr=np.zeros((20,20))
arr[0,:]=3
arr[0,0]=20
arr[19,19]=30
arr[10:12,10:12]=10

filtered_arr=gaussian_filter(arr, sigma)
plt.imshow(filtered_arr)

to get (from top left: raw image, sigma=1,2,3):

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!