Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
269 views
Welcome To Ask or Share your Answers For Others

1 Answer

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:

enter image description here

As you can see, the x-axis has been extended to include negative number starting from -10.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...