python pylab_在Python中使用Pylab的直方图

本文介绍了如何使用Python的Pylab库创建直方图。通过hist()函数,我们可以将随机生成的数值进行排序,分组并展示其分布频率。
摘要由CSDN通过智能技术生成

python pylab

A histogram is a plot which shows the distribution of values in a set of data. The values are sorted first and then divided into classes/group of equal size.

直方图是显示一组数据中值的分布的图。 首先对值进行排序,然后将其分为大小相等的类/组。

So, in this article, we are going to use hist() function to plot the histogram of the sum of randomly generated numbers.

因此,在本文中,我们将使用hist()函数绘制随机生成的数字之和的直方图。

The function pylab.hist(vals, bin = 10) produces a histogram with 10 equally sized groups and the frequency of result in those classes.

函数pylab.hist(vals,bin = 10)生成一个直方图,其中包含10个大小相等的组,以及这些类中结果的频率。

So here is the code:

所以这是代码:

import random
import pylab
val = []

for n in range(1004):
    x = random.choice(range(0,90))
    y = ran
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值