我正在使用seaborn绘制分布图。我想在同一个图上用不同的颜色绘制多个分布图。
下面是我如何启动分布图。
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
iris = load_iris()
iris = pd.DataFrame(data= np.c_[iris['data'], iris['target']],columns= iris['feature_names'] + ['target'])
sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target
0 5.1 3.5 1.4 0.2 0.0
1 4.9 3.0 1.4 0.2 0.0
2 4.7 3.2 1.3 0.2 0.0
3 4.6 3.1 1.5 0.2 0.0
4 5.0 3.6 1.4 0.2 0.0
sns.distplot(iris[['sepal length (cm)']], hist=False, rug=True);
替换代码1】列包含3个值。0, 1, 2.
我希望看到一个萼片长度的分布图,其中target ==0、target ==1和target ==2,共3张图。