From 8dd90e7f36d41cddffc7e3e8bd347af9d8e91d0e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 14 Mar 2012 20:11:05 -0400 Subject: [PATCH] Ugly hack to flush plots to the screen as they are updated. --- pypiezo/afm.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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') -- 2.26.2