python使用plt.imshow在坐标轴上展示图片,坐标设置问题。

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaotao_1/article/details/80953920

坐标默认是从上到下,从左到右,例如
这里写图片描述

matplotlib.pyplot.imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=None, 
                         vmin=None, vmax=None, origin=None, extent=None, shape=None, 
                         filternorm=1, filterrad=4.0, imlim=None, resample=None, 
                         url=None, hold=None, data=None, **kwargs

他的参数很多,找了很久,才发现,应该是设置origin参数。

origin : [‘upper’ | ‘lower’], optional, default: None
    Place the [0,0] index of the array in the upper left or lower left corner of the axes. 
    If None, default to rc image.origin.

origin=‘lower’,就得到如下图:
这里写图片描述

猜你喜欢

转载自blog.csdn.net/xiaotao_1/article/details/80953920