动态残差的绘制参考

动图折线展示:


import numpy as np
import matplotlib.pyplot as plt

plt.ion()
plt.figure(1)
t_list = []
result_list = []
t = 0

while True:
    if t >= 10 * np.pi:
        plt.clf()
        t = 0
        t_list.clear()
        result_list.clear()
        if t>100:
            break
    else:
        t += np.pi / 1
        t_list.append(t)
        result_list.append(np.sin(t))
        plt.plot(t_list, result_list, c='r', ls='-', marker='o', mec='b', mfc='w')  ## 保存历史数据
        # plt.plot(t, np.sin(t), 'o')
        plt.pause(3)
        if t>100:
            break
plt.ion()的使用

https://blog.csdn.net/yzy__zju/article/details/85008603
posted @ 2022-03-20 20:53  kuanleung  阅读(8)  评论(0)    收藏  举报  来源