Python-Matplotlib 8 箱形图

Python-Matplotlib 8 箱形图

 

 

Example 1 

import numpy as np
import matplotlib.pyplot as plt

data = np.random.normal(size =100 , loc = 0 , scale = 1)
plt.boxplot(data , sym='o' , whis=0.05)
print(data)
plt.show()

  

Example 2:

import numpy as np
import matplotlib.pyplot as plt

np.random.seed(100)
data = np.random.normal(size=(1000,4) , loc = 0 , scale=1)
labels = ['A', 'B', 'C' , 'D']
plt.boxplot(data, labels = labels)

plt.show()

  

 

posted @ 2017-02-16 14:45  ZSR0401  阅读(7874)  评论(0编辑  收藏  举报