existMatlab using the Plot function to achieve dynamic data display method summaryIn the introduction of two methods to realize the dynamic display of instant data. Considering the increasing number of people using python, coupled with my recent desire to use python to dynamically display instant data, online methods are few, solid summarized in this.
Sample Code 1
import as plt import numpy as np import time from math import * () The key to success for #enabling interactive mode (1) t = [0] t_now = 0 m = [sin(t_now)] for i in range(2000): t_now = i*0.1 (t_now)# Incremental inflow of analog data (sin(t_now))# Incremental inflow of analog data (t,m,'-r') ()# Note that this function requires a call to (0.01)
Sample Code 2
The above way, can be dynamically displayed within the pop-up drawing panel, but if you want to directly dynamic display in jupyter notebook, the above method will not work. Therefore, fill in the jupyter notebook in the feasible dynamic display sample program. For example, the use of three.
Write the code snippet here
import math import random import numpy as np import matplotlib import as plt %matplotlib inline # set up matplotlib is_ipython = 'inline' in matplotlib.get_backend() if is_ipython: from IPython import display () def plot_durations(y): (2) () (211) (y[:,0]) (212) (y[:,1]) (0.001) # pause a bit so that plots are updated if is_ipython: display.clear_output(wait=True) (()) x = (-10,10,500) y = [] for i in range(len(x)): y1 = (i/(3*3.14)) y2 = (i/(3*3.14)) (([y1,y2])) plot_durations((y))
This is the whole content of this article.