python matplotlib之 hist直方图
来源:互联网 发布:韦德2016季后赛数据 编辑:程序博客网 时间:2024/06/05 17:10
例子如下:
# coding=utf-8import numpy as npfrom numpy.linalg import choleskyimport matplotlib.pyplot as pltsampleNo = 1000;# 一维正态分布# 下面三种方式是等效的mu = 3sigma = 0.1np.random.seed(0)s = np.random.normal(mu, sigma, sampleNo )#s = np.random.rand(1, sampleNo )plt.subplot(141)plt.hist(s, 10, normed=True) #####bins=10np.random.seed(0)s = sigma * np.random.randn(sampleNo ) + muplt.subplot(142)plt.hist(s, 30, normed=True) #####bins=30np.random.seed(0)s = sigma * np.random.standard_normal(sampleNo ) + muplt.subplot(143)plt.hist(s, 30, normed=True) #####bins=30# 二维正态分布mu = np.array([[1, 5]])Sigma = np.array([[1, 0.5], [1.5, 3]])R = cholesky(Sigma)s = np.dot(np.random.randn(sampleNo, 2), R) + muplt.subplot(144)# 注意绘制的是散点图,而不是直方图plt.plot(s[:,0],s[:,1],'+')plt.show()
- hist(x,bins) 函数中bins是指直方图的总个数,个数越多,条形带越紧密。
阅读全文
0 0
- python matplotlib之 hist直方图
- 【Python-matplotlib】画直方图(hist)
- hist()直方图
- hist()R 直方图
- hist 绘制直方图函数
- hist 绘制直方图函数
- 画直方图(hist)
- matplotlib.pyplot.hist(柱状图)
- matplotlib.pyplot.hist()
- [R语言绘图]直方图hist
- cv1.6hist直方图操作
- python matplotlib 画直方图报错
- Python-Matplotlib(4) 直方图与四分图
- python hist的使用
- 使用Hist函数实现图像直方图
- matlab hist函数 绘制直方图
- 2017.07.24回顾 plt.hist直方图绘制
- python之matplotlib学习
- shiro使用总结-简单实现
- SPOJ 8073 CIRU 自适应Simpson积分求圆的面积并 解题报告
- vb.net版机房重构--泛型与Datatable
- 一些小小的时间优化
- 《如何阅读一本书》—— 读后总结
- python matplotlib之 hist直方图
- 温故知新python3--基础知识1
- HDU-2509-Be the Winner【nimm】
- 通过软件程序消除单片机由外界干扰产生的异常复位的影响(基于STM8S105单片机)
- Tensorflow基础
- 如何使用cd命令
- 关于开机时候的一些问题
- CSU 1047 最长上升子序列 (二分水过)
- 不怕进度慢,就怕进度慢