import matplotlib.pyplot as pltimport numpy as npimport timeplt.ion()class plotting_class(): def __init__(self): self.x = [] self.y = [] self.fig, self.ax = plt.subplots() def plotting(self,i): # for i in range(20): self.x.append(i) self.y.append(5*i) self.ax.plot(self.x, self.y, 'b') self.fig.canvas.flush_events()plot_obj = plotting_class()for i in range(20): plot_obj.plotting(i) time.sleep(1) # just to see the additions to the plot if i ==1: plt.show()
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,900 Super User 2024 Season 2
Martin Dráb 229,275 Most Valuable Professional
nmaenpaa 101,156