【发布时间】:2021-04-18 15:10:23
【问题描述】:
有谁知道我如何使用for 循环来遍历它?
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Sepal Length", "Sepal Width").add_legend()
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Petal Length", "Petal Width").add_legend()
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Sepal Length", "Petal Width").add_legend()
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Petal Length", "Sepal Width").add_legend()
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Sepal Length", "Petal Length").add_legend()
sns.FacetGrid(iris, hue = "Species").map(sns.scatterplot, "Petal Width", "Sepal Width").add_legend()
对于 histplots,这很容易,但我试图将这段代码压缩为散点图,但没有成功。我想我每次都需要遍历一对独特的列,但我不知道该怎么做。或者即使这是正确的做法。数据来自 Iris 数据集:http://archive.ics.uci.edu/ml/datasets/Iris
*我知道这是徒劳的,我只是想避免代码中的重复......
谢谢,
菜鸟
【问题讨论】:
标签: python for-loop seaborn scatter-plot iris-dataset