【发布时间】:2020-01-16 23:04:45
【问题描述】:
我想使用 ggplot 获取癌症数据集中每个特征的分布,但它给了我错误。
#pip install plotnine
from plotnine import ggplot
from plotnine import *
from sklearn.datasets import load_breast_cancer
for i in cancer.feature_names:
ggplot(cancer.data)+aes(x=i)+geom_bar(size=10)
这是我收到的错误消息
ValueError:具有多个元素的数组的真值不明确。使用 a.any() 或 a.all()
【问题讨论】:
-
您准备好探索 matplotlib 或 seaborn 进行绘图了吗?
-
既不是 matplotlib 也不是 seaborn,而是 plotnine 库中的 ggplot,实际上 ggplot 是 R 的一个功能,虽然它是 R 我们也可以在 python 中使用。
标签: python-3.x numpy scikit-learn python-ggplot