I currently have a main script, calling a function. Part of that functions functionality is plotting two graphs. The script works if I include show() at the end, but it is a bit annoying that either the script pauses until I close the graph or I have to wait to look at the graphs until the program is finished. Hence I feel like I need to use ion()/ioff(). The code snippet below works if I call the function from the shell, but not if I call it from the script.
#Plot the graphs.
ion()
firstplot = plot(GridAround[Mode], LogTheory[Mode], '.')
secondplot = plot(GridAround[Mode], NormalApprox[Mode])
draw()
ioff()
My question is simply: How do I plot from within a function, without using show() (which will pause the script or only show the graphs at the end)?
I apologize in advance, this question surely must have an answer somewhere on the web, but after a couple of hours of searching, I have not been able to find it.