10.1.1. Opening plot windows¶
PyOPUS provides a wrapper around the MatPlotLib plotting library. The wrapper runs the code that refreshes the windows in a separate thread so that the windows remain active during computation. After a short prologue that sets up the windows the user can plot within those windows using the MatPlotLib API. The resulting figures can be exported in several file formats.
File 01-windows.py in folder demo/plotting/
from pyopus.plotter import interface as pyopl
if __name__ == '__main__':
# Create a figure with default size (matplotlibrc).
f0=pyopl.figure()
print("pyopl.figure() returned: "+str(f0))
# Create a figure with 400x300 pixels, 100dpi. This gives a 4x3 inch image.
f1=pyopl.figure(windowTitle="Window title 1", figpx=(400,300), dpi=100)
print("pyopl.figure() returned: "+str(f1))
# Change window title.
pyopl.title(f1, "Changed window title 2")
# Close a figure.
# pyopl.close(f1)
# Close all figures
# pyopl.close()
# Show/hide (True/False) figure
# pyopl.showFigure(f0, False)
# pyopl.showFigure(f0, True)
# Raise figure / active figure
# pyopl.raiseFigure(f0)
# Wait for the control window to be closed
pyopl.join()