Estoy usando matplotlib en modo interactivo para mostrar al usuario un diagrama que los ayudará a ingresar un rango de variables. Tienen la opción de presionar "?" para mostrar esta gráfica, y luego se repetirá la solicitud de variables.modo interactivo matplotlib: determinar si todavía se muestra la ventana de la figura
¿Cómo sé si no volveré a dibujar este gráfico si todavía se muestra?
Superficialmente, tengo unas pocas cosas torpe (pseudo-ish) Código:
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...
¿Qué puedo usar (en términos de plt.gca(), higo, etc ...) para determinar si necesito volver a trazar? ¿Hay algún estado que pueda verificar?
Muchas gracias,
David
Creo que necesita más claridad en la pregunta. ¿Mantiene un registro de las cifras que han abierto? ¿Puede haber varias figuras a la vez o solo una figura abierta? –