from sklearn import datasets
from sklearn.datasets import load_iris
import pandas as pd
iris = load_iris()
x = iris.data
y = iris.target
data = pd.DataFrame(x, columns=['a', 'b', 'c', 'd'])
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']#解决中文乱码问题
plt.rcParams["font.size"]=10#设置字体大小
plt.boxplot([data.a[data.label==0], data.a[data.label==1]],labels=['0','1'])
plt.title('iris')
# plt.savefig('gender.png',dpi=400)
网友评论