介绍
今天就跟大家聊聊有关怎么在Python中使用pylab库绘制直方图,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
Python直方图
# !/usr/bin/Python #,- *安康;编码:utf-8 - * - import pylab  as pl 时间=dataFile “dataList.txt" 时间=tempList [] with 开放(功能,“r"), as 数据: for 才能;everLine 拷贝数据: ,,,arrEverLine =,(浮动(索引),for index 拷贝everLine.split ()) ,,,tempList.append (arrEverLine [0]) pl.hist (tempList, 100) pl.xlabel(“直方图标题,,,fontproperties=& # 39; SimHei& # 39;) pl.show ()
dataList。txt内容
14 2 1 0.5 - 0.5 0 1 0.5 0.5 1.5 18.5
引用>
19 2 2 1 0 1 0.5 0 21
19.5 0.5 1.5 - 2 0 2 0 1 20
1.5 17.5 1.5 1.5 - 1 2 0 0 0 18.5 19.5
2 2 2 0 1 0 0.5 0.5 0.5 19.5 16.5
2 1 0 0 0.5 0.5 1.5 0.5 19.5 15.5
2 1 0 0 1 1 17.5
13.5 1.5 0.5 0.5 1 1 2 0 2 2 20
14.5 18.5 1.5 - 2 0 0 1 0 2
16 2 2 1.5 0.5 1 1 0 2 19.5
…输出结果
看完上述内容,你们对怎么在Python中使用pylab库绘制直方图有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。
怎么在Python中使用pylab库绘制直方图