hist的使用
来源:互联网 发布:如何买域名和空间视频 编辑:程序博客网 时间:2024/06/05 07:36
hist的api参数很多,如果要知道每个含义得一个一个去试,看了doc,这个hist的参数挺多的,api中有个简明的例子,我们使用几个重要的参数即可
函数签名
matplotlib.pyplot.hist(x, bins=10, range=None, normed=False, weights=None, cumulative=False, bottom=None, histtype=u'bar', align=u'mid', orientation=u'vertical', rwidth=None, log=False, color=None, label=None, stacked=False, hold=None, **kwargs)
x : (n,) array or sequence of (n,) arrays
这个参数是指定每个bin(箱子)分布的数据,对应x轴
bins : integer or array_like, optional
这个参数指定bin(箱子)的个数,也就是总共有几条条状图
normed : boolean, optional
If True, the first element of the return tuple will be the counts normalized to form a probability density, i.e.,n/(len(x)`dbin)
这个参数指定密度,也就是每个条状图的占比例比,默认为1
color : color or array_like of colors or None, optional
这个指定条状图的颜色
我们绘制一个10000个数据的分布条状图,共50份,以统计10000分的分布情况
"""Demo of the histogram (hist) function with a few features.In addition to the basic histogram, this demo shows a few optional features: * Setting the number of data bins * The ``normed`` flag, which normalizes bin heights so that the integral of the histogram is 1. The resulting histogram is a probability density. * Setting the face color of the bars * Setting the opacity (alpha value)."""import numpy as npimport matplotlib.mlab as mlabimport matplotlib.pyplot as plt# example datamu = 100 # mean of distributionsigma = 15 # standard deviation of distributionx = mu + sigma * np.random.randn(10000)num_bins = 50# the histogram of the datan, bins, patches = plt.hist(x, num_bins, normed=1, facecolor='blue', alpha=0.5)# add a 'best fit' liney = mlab.normpdf(bins, mu, sigma)plt.plot(bins, y, 'r--')plt.xlabel('Smarts')plt.ylabel('Probability')plt.title(r'Histogram of IQ: $\mu=100$, $\sigma=15$')# Tweak spacing to prevent clipping of ylabelplt.subplots_adjust(left=0.15)plt.show()
0 0
- hist的使用
- hist的使用
- python hist的使用
- matlab hist函数的使用
- MATLAB实现频数直方图——hist的使用
- MATLAB实现频数表——hist的使用
- MATLAB实现频数直方图——hist的使用
- Hist
- hist 和imhist的区别
- matlab hist函数的用法
- 使用Hist函数实现图像直方图
- matlab中的hist函数的应用
- 关于matlab的hist函数取之后的折线
- matlab中hist和histc函数的用法
- Matlab中hist、 histc、bar函数的用法及区别:
- 学习:hist
- hist函数
- hist()直方图
- Android中解析json数据的方式之一:Gson
- 软件测试管理要素
- 杭电 acm 2001(计算两点间的距离)
- 实战利用apache来做集群,实现负载均衡
- 祭奠
- hist的使用
- 使用命令窗口(cmd)向数据库中写入数据
- 在 iOS 中获取唯一标识符的几种方案
- 向ActionBar中添加自定义的View
- LeetCode 题解(266) : Inorder Successor in BST
- 安卓解析XML文件系列3:使用DOM方式
- ECS 服务器CentOS系统如何开放端口
- ssh集成
- 自增符号++(自减符号--)带来的部分影响