matplotlib箱线图与柱状图比较

代码:

 1 # -*- coding: utf-8 -*-
 2 """
 3 Created on Thu Jul 12 16:37:47 2018
 4 
 5 @author: zhen
 6 """
 7 
 8 """
 9     对比箱线图与柱状图
10 """
11 from pylab import *
12 dataset = [113, 115, 119, 121, 124,
13            124, 125, 126, 126, 126,
14            127, 127, 128, 129, 130,
15            130, 131, 132, 133, 136]
16 
17 subplot(121)
18 
19 boxplot(dataset, vert=False)
20 
21 subplot(122)
22 hist(dataset)
23 
24 show()

结果:

matplotlib箱线图与柱状图比较_第1张图片

 

你可能感兴趣的:(matplotlib箱线图与柱状图比较)