通过调节刻度,让界面近似正方形:
import numpy as np
import matplotlib.pyplot as plt
# N = 100
a_data=[[238.0,277.0],
[206.0,270.0],
[197.0,261.0],
[188.0,256.0],
[233.0,263.0],
[217.0,256.0],
[198.0,249.0],
[192.0,244.0],
[217.0,230.0],
[192.0,227.0],
[223.0,210.0],
[201.0,201.0],
[207.0,200.0],
[211.0,171.0],]
a_data=np.asarray(a_data)
x = 480-a_data[:,0]
y = a_data[:,1]
fig, ax = plt.subplots()
ax.scatter(x, y, c='r')
for i in range(len(a_data)):
ax.annotate(str(i), (x[i], y[i]))
plt.xlim(100, 500)
# 把x轴的刻度范围设置为-0.5到11,因为0.5不满一个刻度间隔,所以数字不会显示出来,但是能看到一点空白
plt.ylim(100, 400)
# plt.savefig('./test2.jpg')
plt.show()