Python 在Seaborn中使用relplot的标题
我正在使用以下代码绘制一些新冠病毒数据。但是,无法获得图表的标题。我也无法用源代码的文本对图形进行注释。请帮忙Python 在Seaborn中使用relplot的标题,python,seaborn,Python,Seaborn,我正在使用以下代码绘制一些新冠病毒数据。但是,无法获得图表的标题。我也无法用源代码的文本对图形进行注释。请帮忙 sns.set(style='darkgrid') #plot a scatterplot with 'Confirmed' on x and 'Deaths' on y-axis sns.relplot(x = 'log_Confirmed', y= 'log_Deaths', kind='scatter', data=df3, col='Province_S
sns.set(style='darkgrid')
#plot a scatterplot with 'Confirmed' on x and 'Deaths' on y-axis
sns.relplot(x = 'log_Confirmed', y= 'log_Deaths', kind='scatter',
data=df3, col='Province_State', col_wrap=3)
plt.title('COVID- 19 Deaths - Select US States ')
plt.annotate('Source: JHU Coronavirus Resource Center', (0,0), (0, -40),
xycoords='axes fraction', textcoords='offset points',
va='top', fontsize=6)
sns.relplot()
是一个图形级函数,可在FaceGrid
中创建多个轴<另一方面,code>plt.XXXX()函数作用于“当前”轴,通常是最后创建的轴
如果要向地物添加内容,应使用地物级别函数,例如,或在地物坐标中使用注释:
tips = sns.load_dataset('tips')
g = sns.relplot(x="total_bill", y="tip",
hue="day", col="time", data=tips)
g.fig.suptitle('Figure title', fontsize=20, fontweight='bold')
plt.annotate("Annotation in figure coordinates", xy=(0,0), xycoords='figure fraction', va='bottom', ha='left')
sns.relplot()
是一个图形级函数,可在FaceGrid
中创建多个轴<另一方面,code>plt.XXXX()函数作用于“当前”轴,通常是最后创建的轴
如果要向地物添加内容,应使用地物级别函数,例如,或在地物坐标中使用注释:
tips = sns.load_dataset('tips')
g = sns.relplot(x="total_bill", y="tip",
hue="day", col="time", data=tips)
g.fig.suptitle('Figure title', fontsize=20, fontweight='bold')
plt.annotate("Annotation in figure coordinates", xy=(0,0), xycoords='figure fraction', va='bottom', ha='left')