Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/12/2013, 13:38
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 1 mes
Puntos: 1360
Respuesta: Actualizar plot dinamicamente

Pequeño ejemplo

Código Python:
Ver original
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3.  
  4. x = np.arange(-100, 100)
  5. y = ((.1 * x) ** 2)
  6.  
  7. plt.ion()
  8.  
  9. fig = plt.figure()
  10. ax = fig.add_subplot(111)
  11. line, = ax.plot(x, y)
  12. ax.set_xlim(-100, 100)
  13. ax.set_ylim(-10, 100)
  14. fig.canvas.draw()
  15.  
  16. for i in range(len(x)):
  17.     line.set_xdata(x[:i])
  18.     line.set_ydata(y[:i])
  19.     fig.canvas.draw()