X-Git-Url: http://git.tremily.us/?p=unfold-protein.git;a=blobdiff_plain;f=unfold_protein%2Funfolder.py;fp=unfold_protein%2Funfolder.py;h=57def437eed744150ae91e4b380bfb5ebb95c207;hp=5a827169850f51c4fdc1118d9b331351a53d917b;hb=3afbb2f9d48a8fb665db2413f1ce2f7f2cacff38;hpb=1520bd23fb9c19fa76f5c6526d309fc9a269689b diff --git a/unfold_protein/unfolder.py b/unfold_protein/unfolder.py index 5a82716..57def43 100755 --- a/unfold_protein/unfolder.py +++ b/unfold_protein/unfolder.py @@ -33,6 +33,7 @@ from . import package_config as _package_config try: import numpy as _numpy + import matplotlib as _matplotlib from matplotlib import pyplot as _pyplot _pyplot.ion() FIGURE = _pyplot.figure() @@ -118,7 +119,11 @@ class Unfolder (object): axes = FIGURE.add_subplot(1, 1, 1) axes.plot(data['z'], data['deflection'], label='Approach') axes.set_title('Unfolding too far') - _pyplot.show() + FIGURE.canvas.draw() + if hasattr(FIGURE, 'show'): + FIGURE.show() + if not _matplotlib.is_interactive(): + _pyplot.show() _LOG.debug('raising ExceptionTooFar') raise ExceptionTooFar return data @@ -233,8 +238,11 @@ class Unfolder (object): axes.plot(unfold['z'], unfold['deflection'], label='Unfold') axes.legend(loc='best') axes.set_title('Unfolding') - _pyplot.draw() - _pyplot.show() + FIGURE.canvas.draw() + if hasattr(FIGURE, 'show'): + FIGURE.show() + if not _matplotlib.is_interactive(): + _pyplot.show() def zero_piezo(self): _LOG.info('zero piezo')