problems with ipython, plot script and show()

Hi,

I wrote a script for automatically plot spectra data from multiple raw files into one plot. After that, I implemented a calibration function to extract specific values from the spectras and want to plot them in an extra plot window.

Executing script with "python plotfile.py":

hold(True)

"loop for plotting the spectras into one plot."

show()

# Plot is appearing, can be stored, script continous after closing the window.

hold(False) # using a new window
" Calibration function"

show()

# New plot is appearing, can be stored.

I know, that I should avoid to use show() several times, but I didn't find any other solution for it. The problem is, I would favor to use ipython running the script and then being in interactive mode to correct something interactively.

Unfortunately, using ipython results in one overall plot, appearing after the end of the whole script, containing the spectras and the calibration function.

So what I want to do is:

1) Plotting the spectras with a script
2) Interactively change them
3) Save the plots and close the GUI
4) Make the calibration with the script
5) Interactively change this plot
6) Save and exit

Is this possible within one script, or do I have to split it into several shorter ones ?

Regards

Werner

W. Pessenhofer wrote:

Hi,

I wrote a script for automatically plot spectra data from multiple raw files into one plot. After that, I implemented a calibration function to extract specific values from the spectras and want to plot them in an extra plot window.

Executing script with "python plotfile.py":

hold(True)

"loop for plotting the spectras into one plot."

show()

# Plot is appearing, can be stored, script continous after closing the window.

hold(False) # using a new window
" Calibration function"

show()

# New plot is appearing, can be stored.

I know, that I should avoid to use show() several times, but I didn't find any other solution for it. The problem is, I would favor to use ipython running the script and then being in interactive mode to correct something interactively.

Unfortunately, using ipython results in one overall plot, appearing after the end of the whole script, containing the spectras and the calibration function.

As John indicated, the problem of all plots ending up on the same figure is caused by your not creating new figures via figure() calls as needed.

However, I'm not sure I see how you can apply modifications to your figures while in the middle of a script. How do you intend to block script execution, and your changes to feed back? Or are you using the OO API to extract events from the plotting windows and use that data to proceed? I suspect I'm just missing something in your question, I'm sorry. Perhaps with a bit more detail we can help you better.

Cheers,

f