更新时间:2023-11-14 17:28:58
你可以使用 imshow() 的 aspect 参数来调整高度和高度之间的比例.重量:
you can use aspect parameter of imshow() to adjust the ratio between the height & weight:
from pylab import *
a = np.zeros((100,10)) # height=100, weight=10
subplot(211)
imshow(a) # ratio = 10
subplot(212)
imshow(a, aspect=0.1) # ratio = 1
show()
但是它将拉伸图像.
或者您可以使用 xlim(), ylim() 设置 x-y 轴的范围.
or you can use xlim(), ylim() the set the range of x-y axis.
imshow(a)
xlim(-50,50)
imshow() 会将 ax 的方面属性设置为相等".你需要在调用 plot() 之前重置它:
imshow() will set the aspect property of axe to "equal". you need reset it before calling plot():
self.ui.mplWidget.canvas.ax.set_aspect("auto")
self.ui.mplWidget.canvas.ax.plot(self.xData,self.yData)