python - Multiple Plots in Matplotlib Widget -


i have designed relatively large application facing problem in implementing matplotlibwidget graphs. snippet of code handling graph.

the following code plots latest plot of x2 , y2.

note: here self.graphwidget matplotlibwidget object implemented using qtdesigner

def toggled(self,cd):      self.graphwidget.axes.plot(self.x1,self.y1,label='plot1')     self.graphwidget.axes.plot(self.x2,self.y2,label='plot2')              self.graphwidget.axes.set_xscale('log')      self.graphwidget.legend()     self.graphwidget.draw() 

the following code (see below) plots both curves on graph i'd rather use above method can give individual labels etc each curve:

def toggled(self,cd):      self.graphwidget.axes.plot(self.x1,self.y1,self.x2,self.y2)       self.graphwidget.axes.set_xscale('log')      self.graphwidget.legend()     self.graphwidget.draw() 

try explicitly setting hold:

self.graphwidget.axes.hold(true) self.graphwidget.axes.plot(self.x1,self.y1,label='plot1') self.graphwidget.axes.plot(self.x2,self.y2,label='plot2')   

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -