Undock plots in python window


Hello,
I am using Compose 2019. I would like to use matplotlib in phyton to plot some figures. However, I need to plot them as undocked figures. Could this be possible?
I created an example to better explain the issue. Attached you will find a .oml file and .py file. The oml file creates the variables and plots a simple figure. You will see commands which adjust the position of the figure on the screen. The oml file also exports the variables to python and calls .py file which plots the same figure in the Python window. I would like those two figures in the same position and size. Is that possible?
Thank you
Berker
Answers
-
Hi Berker,
As Python doesn't uses the plotting framework of OML, you can undock/dock the figure in python by using run_line_magic ipython api's set the positions and sizes.
add below lines in your script to create pop up figure window from Python
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'qt')And to size the figure window you can use 'matplotlib.rcParams['figure.figsize'] = (h, b)' where h and b are widow size.
Note: get_ipython().run_line_magic('matplotlib', 'qt') undocks the figure window and get_ipython().run_line_magic('matplotlib', 'inline') docks the figure in command window.
I have edited your python script as attached. hope this helps.
If you want to have the plots inside OML only, then you can transfer the data from python back to Compose OML (by using getpythonvar command) and then plot inside OML.
Did you try transferring of data back to OML from python and then do plotting inside OML?
Thanks,
Manoj kandukuri
0