You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def update_graph(x, y, refresh_time):
plt.plot(x, y)
plt.pause(refresh_time)
plt.show()
maybe used refresh time (1/sampling frequency) this may work
def update_graph(x, y, refresh_time):
plt.ion() # Turn on interactive mode (important for updating plot)
fig, ax = plt.subplots() # Create figure and axis objects
while True:
# example data generation
x_new = np.linspace(0, 10, 100)
y_new = np.random.rand(100)
# Update existing plot with new data
ax.clear() # Clear previous plot
ax.plot(x_new, y_new) # Plot new data
# set axis limits
ax.set_xlim(0, 10)
ax.set_ylim(0, 1)
plt.pause(refresh_time) # Pause to update plot
fig.canvas.flush_events() # Flush events to update plot
def update_graph(x, y, refresh_time):
plt.plot(x, y)
plt.pause(refresh_time)
plt.show()
maybe used refresh time (1/sampling frequency) this may work
def update_graph(x, y, refresh_time):
plt.ion() # Turn on interactive mode (important for updating plot)
fig, ax = plt.subplots() # Create figure and axis objects
update_graph(None, None, 0.1)
WhatsApp.Video.2024-04-18.at.10.22.14_07eb096a.mp4