删除 seaborn 折线图的图例标题
- 论坛
- 删除 seaborn 折线图的图例标题
12 浏览
删除 seaborn 折线图的图例标题
我想要从我的seaborn折线图图例中移除标题。我尝试使用这个答案,但没有成功:
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('')
如果我尝试将标题设置为None
,结果是一样的。有趣的是,将标题设置为其他内容似乎会在现有标题之前加上:
ax.legend().set_title('Something else')
看起来seaborn好像将标题视为隐藏的图例条目。我该如何解决这个问题?