I am using matplotlib to dynamically plot a graph with both my x and y points taken from a measurement device. That is to say, in each iteration of my while loop I'm reading two variables which I then want to plot with matplotlib.
I wrote something which
goes like this (disregard the Gnuplot - that's what I'm trying to
replace with matplotlib...)
Numeric, time, Gnuplot, mymodule, threading
from pylab import *
def cooldown(filename, dmm_gpib, lake_gpib):
scans dummy and reads HP and Lakeshore"""
A = Numeric.arange(-1, 1, .1)
delay = 1
f = open(filename,'w')
X = 
Y = 
gpib.write(lake_fd, 'SDAT?')I'm running this code in ipython with the -pylab option, so I don't need to use show(). My question is, how do I maintain a *constant* xlabel and ylabel without having to redraw them each time I append a point to the graph? If I try xlabel('something') then obviously it's cleared each time I use plot(X,Y).
val1 = float(gpib.read(lake_fd, 30))
val2 = float(gpib.read(hp_fd, 30))
f.write(str(val1) + '\t' + str(val2) + '\n')