小编Dum*_* ML的帖子

如何在seaborn中为relplot添加标题?

这应该很容易,但我已经尝试了很多东西(基于seaborn relplot:如何控制图例的位置并添加标题如何向Seaborn Facet Plot添加标题以及文档),但没有任何效果。

我尝试过的事情:

g = sns.relplot(x="col1", y="col2", data=df, height=6, aspect=2);
g.add_legend(title="Col1 x Col2");
Run Code Online (Sandbox Code Playgroud)

还:

g = sns.relplot(x="col1", y="col2", data=df, height=6, aspect=2).set_title('Col1 x Col2')
Run Code Online (Sandbox Code Playgroud)

和:

plt.title('Col1 x Col2')
g = sns.relplot(x="col1", y="col2", data=df, height=6, aspect=2);
Run Code Online (Sandbox Code Playgroud)

好吧,没有任何效果。我希望标题位于图表的顶部,就像 plt.title() 通常所做的那样。

python pandas seaborn facet-grid

1
推荐指数
1
解决办法
3668
查看次数

标签 统计

facet-grid ×1

pandas ×1

python ×1

seaborn ×1