1. 程式人生 > >python使用plt.imshow在座標軸上展示圖片,座標設定問題。

python使用plt.imshow在座標軸上展示圖片,座標設定問題。

座標預設是從上到下,從左到右,例如
這裡寫圖片描述

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’,就得到如下圖:
這裡寫圖片描述