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()