Toccata in Nowhere.

Python imshow/imagesc修改坐标范围

2020.02.26

保持map比例的同时更改坐标范围。

可在 imshow() 函数参数内添加extent=[xmin,xmax,ymax,ymin] xmin> xmax可行,只考虑空间关系

使用例

import matplotlib.pyplot as plt
import numpy as np
mat = np.zeros((100,100))
plt.figure()
for ii in range(100):
	for jj in range(100):
		mat[ii,jj] = (ii*ii + jj*jj)/1000

plt.imshow(mat,cmap='seismic', extent=[80,120,32,0])
plt.show()