You're almost there, you only need to modify your plot()
function and use plot.set_xlim()
like so:
...
...
def plot(self):
data = [random.random() for i in range(25)]
plot = self.figure.add_subplot(111)
plot.plot(data, 'r-')
plot.set_xlim(left=-10) #<-- added here
plot.set_title('PyQt Matplotlib Example')
self.draw()
And it generates this plot:
As you can see, the x-axis has been extended to include negative number starting from -10
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…