【发布时间】:2020-10-08 08:23:18
【问题描述】:
我首先使用以下代码创建了一个线图:
plot = sns.lineplot(data=tips,
x="sex",
y="tip",
ci=50,
hue="day",
palette="Accent")
plot.set_title("Value of Tips Given to Waiters, by Days of the Week and Sex", fontsize=24, pad=30, fontdict={"weight": "bold"})
plot.legend("")
我意识到它实际上是一个我需要的 catplot 图表,因此我将代码修改为以下内容:
plot = sns.catplot (data=tips,
x="day",
y="tip",
kind='bar',
ci=50,
hue="sex",
palette="Accent")
plot.set_title("Value of Tips Given to Waiters, by Days of the Week and Sex", fontsize=24, pad=30, fontdict={"weight": "bold"})
plot.legend("")
但是我收到以下标题错误消息:'AttributeError: 'FacetGrid' object has no attribute 'set_title''。
为什么我的标题不适用于 catplot 图表?
【问题讨论】:
-
这能回答你的问题吗? stackoverflow.com/questions/43920341/…>