Resistribute vib_analyze pylab.hold()s to avoid auto-generated axis.
[calibcant.git] / calibcant / vib_analyze.py
index 33a829b70bf4b559fec896c1b920710aed1e6dcf..dc4af3b494684117127e619e3098ddbefd87024f 100755 (executable)
@@ -254,15 +254,16 @@ def vib_plot(deflection_bits, freq_axis, power, A, B, C,
         print "plotting"
         common._import_pylab()
         common._pylab.figure(config.BASE_FIGNUM+2)
-        common._pylab.hold(False)
 
         # plot time series
         common._pylab.subplot(311)
+        common._pylab.hold(False)
         common._pylab.plot(deflection_bits, 'r.')
         common._pylab.title("free oscillation")
 
         # plot histogram distribution and gaussian fit
         common._pylab.subplot(312)
+        common._pylab.hold(False)
         n, bins, patches = \
             common._pylab.hist(deflection_bits, bins=30,
                                normed=1, align='center')
@@ -278,13 +279,17 @@ def vib_plot(deflection_bits, freq_axis, power, A, B, C,
         common._pylab.hold(False)
 
         # plot FFTed data
-        common._pylab.subplot(313)
+        axes = common._pylab.subplot(313)
+        common._pylab.hold(False)
         common._pylab.semilogy(freq_axis, power, 'r.-')
         fitdata = C / ((A**2-freq_axis**2)**2 + (B*freq_axis)**2)
+        xmin,xmax = axes.get_xbound()
+        ymin,ymax = axes.get_ybound()
         common._pylab.hold(True)
         common._pylab.plot(freq_axis, fitdata, 'b-');
         common._pylab.hold(False)
-        
+        axes.axis([xmin,xmax,ymin,ymax])
+
         common._flush_plot()
     if (plotVerbose or config.GNUPLOT_VERBOSE): # TODO: cleanup and test
         # write all the ft data now