I am using matplotlib in interactive mode to show the user a plot that will help them enter a range of variables. They have the option of hitting "?" to show this plot, and the prompt for variables will then be repeated.
How do I know to not re-draw this plot if it's still being displayed?
Superficially, I have this clunky (pseudo-ish) code:
answer = None
done_plot = False
while answer == None:
answer = get_answer()
if answer == '?':
if done_plot:
have_closed = True
##user's already requested a plot - has s/he closed it?
## some check here needed:
have_closed = ?????
if have_closed == False:
print 'You already have the plot on display, will not re-draw'
answer = None
continue
plt.ion()
fig = plt.figure()
### plotting stuff
done_plot = True
answer = None
else:
###have an answer from the user...
what can I use (in terms of plt.gca(), fig etc...) to determine if I need to re-plot? Is there a status somewhere I can check?
Many thanks,
David