Hello,
I have a package that has many functions that bring up plots to show data and interactive plots to interact with data. How can I have my figures show and both be on top and be in focus? The best way I have found to manage Matplotlib plots in my package is to use interactive mode plt.ion() and pause the program with raw_input() statements to show or interact with the plots. This has been working fine with one exception. I have not been able to figure out how have the plot figure come up and have the figure both be on top and in focus. I am using Window XP,Python 2.5.4, Matplotlib version 1.0.0 with backend Tkagg. Tk has a command focus_force(), I have not been able to find a similar command in Matplotlib.
This is a simple example demonstrating the plotting behavior. The second plot is rendered but is not in windows focus.
import matplotlib.pyplot as plt
plt.ion()
fig = plt.figure(figsize=(10,8))
ax = fig.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Fisrt Plot')
raw_input('Enter to close and Continue: ')
plt.close(fig)
fig2 = plt.figure(figsize=(10,8))
ax = fig2.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Second Plot')
raw_input('Enter to close and Continue: ')
plt.close(fig2)
Thank you,
Bob Kestner
|