相关疑难解决方法(0)

删除seaborn lineplot图例标题

我想从我的seaborn lineplot图例中删除标题.我尝试使用这个答案无济于事:

import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
fmri = sns.load_dataset("fmri")
fig, ax = plt.subplots()
g = sns.lineplot(x="timepoint", y="signal", hue="event", data=fmri, ax=ax)
ax.legend().set_title('')
Run Code Online (Sandbox Code Playgroud)

Seaborn lineplot仍然带有'event'标题

如果我尝试将标题设置为,我会得到相同的结果None.有趣的是,将标题设置为其他内容似乎优先于现有标题:

ax.legend().set_title('Something else')
Run Code Online (Sandbox Code Playgroud)

Seaborn lineplot仍然有前置标题

看起来seaborn几乎将标题视为隐藏的传奇条目.我该如何解决这个问题?

python matplotlib line-plot seaborn

18
推荐指数
3
解决办法
7969
查看次数

更改 Seaborn 散点图中的图例位置和标签

我想在 Seaborn 散点图中更改我的图例的位置和标签。这是我的代码:

ax_total_message_ratio=sns.scatterplot(x='total_messages', y='email_messages_ratio',hue='poi',data=df_new)
ax_total_message_ratio.set_title("Email Messages Ratio vs. Total Messages Across Poi",y=1.12,fontsize=20,fontweight='bold')
ax_total_message_ratio.set_ylabel('Email Messages Ratio')
ax_total_message_ratio.set_xlabel('Total Messages')
ax_total_message_ratio.legend.loc("lower right")
put.show()
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明 但我收到以下错误消息; 'function' object has no attribute 'loc'. 我可以获得有关如何使用 Seaborn 控制传奇的帮助吗?此外,我还需要在图例标签0中用 No 和1Yes替换。谢谢

python python-2.7 seaborn

3
推荐指数
2
解决办法
7068
查看次数

标签 统计

python ×2

seaborn ×2

line-plot ×1

matplotlib ×1

python-2.7 ×1