From: W. Trevor King Date: Thu, 15 Mar 2012 00:11:05 +0000 (-0400) Subject: Ugly hack to flush plots to the screen as they are updated. X-Git-Tag: 0.6~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8dd90e7f36d41cddffc7e3e8bd347af9d8e91d0e;p=pypiezo.git Ugly hack to flush plots to the screen as they are updated. --- diff --git a/pypiezo/afm.py b/pypiezo/afm.py index 106885d..da631b0 100644 --- a/pypiezo/afm.py +++ b/pypiezo/afm.py @@ -379,6 +379,8 @@ class AFMPiezo (_base.Piezo): if plot: if not _matplotlib: raise _matplotlib_import_error + interactive = _matplotlib.is_interactive() + _matplotlib.interactive(True) figure = _matplotlib_pyplot.figure() axes = figure.add_subplot(1, 1, 1) axes.hold(False) @@ -386,6 +388,8 @@ class AFMPiezo (_base.Piezo): axes.set_title('wiggle for interference %s' % timestamp) plot_p = axes.plot(out, out, 'b.-') figure.show() + _matplotlib_pyplot.draw() + _matplotlib_pyplot.show() cycle = 0 c = _CheckForKeypress(test_mode=keypress_test_mode) while c.input() == None: @@ -407,8 +411,10 @@ class AFMPiezo (_base.Piezo): if plot: plot_p[0].set_ydata(data[:,0]) axes.set_ylim([data.min(), data.max()]) - #_flush_plot() + _matplotlib_pyplot.draw() cycle += 1 + if plot: + _matplotlib.interactive(interactive) self.last_output[config['axis']] = out[-1,0] _LOG.debug('interference wiggle complete')