在 seaborn 中转置因子图
Transpose factorplot in seaborn
按照我的 如何绘制几个箱形图,现在我想知道如何转置因子图而不是 1x5 图片
我需要将其设置为 5x1。
如何垂直对齐因子图?
对于 seaborn 箱线图,您需要使用 row
参数来提供沿行映射的数量,而不是 col
参数。
import seaborn as sns
import matplotlib.pyplot as plt
titanic = sns.load_dataset("titanic")
g = sns.factorplot(y="age", x="embark_town",
hue="sex", row="class",
data=titanic[titanic.embark_town.notnull()],
orient="v", kind="box", size=3)
plt.show()
按照我的
我需要将其设置为 5x1。
如何垂直对齐因子图?
对于 seaborn 箱线图,您需要使用 row
参数来提供沿行映射的数量,而不是 col
参数。
import seaborn as sns
import matplotlib.pyplot as plt
titanic = sns.load_dataset("titanic")
g = sns.factorplot(y="age", x="embark_town",
hue="sex", row="class",
data=titanic[titanic.embark_town.notnull()],
orient="v", kind="box", size=3)
plt.show()