Matplotlib学习(5)--直方图
四 直方图 由一系列高度不等的纵向条形组成 (1)1D直方图 import numpy as np import matplotlib . pyplot as plt mu = 100 sigma = 20 x = mu + sigma * np . random . randn ( 20000 ) # density=True表示出现的频率大小 plt . hist ( x , bins = 100 , color = 'b' , density = True ) 程序运行结果如下图 (2)2D直方图 import numpy as np import matplotlib . pyplot as plt x = np . random . randn ( 1000 ) + 2 y = np . random . randn ( 1000 ) + 3 plt . hist2d ( x , y , bins = 40 ) 程序运行结果如下图示意 来源: CSDN 作者: bingxiash 链接: https://blog.csdn.net/u014168855/article/details/104070637