hello,
im currently working on data analysis with matplotlib/numpy/scipy,
my programm plots data with plot() and waits for input commands via __call__
with the x key it is possible to save data points and plot them into the
figure,
the r key can be used to remove points from data/figure,.
the programm works quite good so far, except if i want to remove a data
point,
i turned of self.dataplot.set_autoscale_on(False), to avoid that there is a
zoom out when i save/remove data points.
the problem is that this just works if i save an new point, if i want to
remove a point via "r" the figure zooms out
each time altough the autoscale is on False ....
here a short part of my source code:
def __call__(self, event):
if event.key == "x":
self.x.append(event.xdata)
self.y.append(event.ydata)
self.N = self.N + 1
plt.axvline(event.xdata, ymin=0, ymax=600, linestyle="--")
rest = event.xdata % 4.0e-7
index = int((event.xdata-rest)/4.0e-7-1)
plt.plot(self.time[index],self.temp[index],'g^')
self.history.append(False)
if (self.N%2 == 0) and self.N <17:
p1, p2 = self.x[len(self.x)-2],self.x[len(self.x)-1]
if p1>p2:
p1, p2 = p2, p1
self.lgdata.append(self.linreg(p1,p2,self.messdaten))
lgx=np.arange(p1-0.001,p2+0.001,0.001)
ram=len(self.lgdata)-1
plt.plot(lgx,self.lgdata[ram][0]*lgx+self.lgdata[ram][1],'r-')
self.history.append(True)
plt.xlabel('N = '+str(self.N))
plt.draw()
elif event.key == "r":
if (self.remove == True) or (self.N>16):
if self.history[len(self.history)-1]==True:
self.lgdata.pop()
del self.dataplot.lines[len(self.dataplot.lines)-1]
elif self.history[len(self.history)-1]==False:
self.x.pop()
self.y.pop()
self.N = self.N-1
plt.xlabel('N = '+str(self.N))
del self.dataplot.lines[len(self.dataplot.lines)-1]
del self.dataplot.lines[len(self.dataplot.lines)-1]
self.history.pop()
plt.xlabel('N = '+str(self.N))
plt.draw()
i hope somebody can help me
···
--
View this message in context: http://old.nabble.com/matplot-zoomout-draw()-tp31769233p31769233.html
Sent from the matplotlib - users mailing list archive at Nabble.com.