一、总结

一句话总结:

动态画直方图的原理非常简单:就是不断的清除画布的图像,生成新的图像,只要速度足够快,眼睛追不上,那么我们看到的就是动画
import numpy as np
import matplotlib.pyplot as plt
%matplotlib qt5

a=np.array([])
for i in range(110):
    for _ in range(100):
        add_num=np.sum(np.random.rand(90))
        a=np.append(a,add_num)
        pass
    # plt.clf() # Clear the current figure.
    plt.cla()   # Clear the current axes.
    plt.hist(a, bins=30, color='g', alpha=0.75)  # hist:绘制直方图
    plt.grid()
    plt.pause(0.1)
    plt.show()

 

 

二、画动态直方图

博客对应课程的视频位置:

 

动态画直方图的原理非常简单:就是不断的清除画布的图像,生成新的图像,只要速度足够快,眼睛追不上,那么我们看到的就是动画

In [4]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib qt5

a=np.array([])
for i in range(110):
    for _ in range(100):
        add_num=np.sum(np.random.rand(90))
        a=np.append(a,add_num)
        pass
    # plt.clf() # Clear the current figure.
    plt.cla()   # Clear the current axes.
    plt.hist(a, bins=30, color='g', alpha=0.75)  # hist:绘制直方图
    plt.grid()
    plt.pause(0.1)
    plt.show()
matplotlib库疑难问题---11、画动态直方图
 
 

本系列博客对应课程位置:
1、解决中文乱码问题-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/371
2、将曲线平滑-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/372
3、matplotlib绘图核心原理-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/373
4、画动态图-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/374
5、保存动态图-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/375
6、显示图片-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/376

7、去掉刻度和边框-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/383

8、几个点画曲线-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/384

9、画箭头(综合实例)-1-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/391

9、画箭头(综合实例)-2-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/392

10、画直方图-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/393

11、画动态直方图-范仁义-读书编程笔记
https://www.fanrenyi.com/video/43/394

 

相关文章:

  • 2022-01-07
  • 2021-07-18
  • 2022-12-23
  • 2022-01-09
  • 2022-01-04
  • 2021-12-14
  • 2021-09-26
  • 2021-11-19
猜你喜欢
  • 2021-12-10
  • 2022-02-04
  • 2022-02-10
  • 2021-07-09
  • 2022-02-07
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案