简体   繁体   English

在 Seaborn Countplot 上创建轴标签

[英]Creating Axis Labels on Seaborn Countplot

I want to add axis labels to a Seaborn countplot I have created using the following code:我想将轴标签添加到我使用以下代码创建的 Seaborn 计数图中:

chart = sns.countplot(df_["HOURS"]).set_title("Number of Calls Reporting Burglary For Each Day of the Week")

I tried using the following method to create labels for the X and Y axes:我尝试使用以下方法为 X 和 Y 轴创建标签:

#.set(xlabel='Hour', ylabel='Number of Calls')

However, this returned:但是,这返回了:

AttributeError: 'Text' object has no property 'ylabel'

How can I add x and y labels on this plot?如何在此图上添加 x 和 y 标签?

Do

import matplotlib.pyplot as plt

chart.set(xlabel='', ylabel='')
plt.show()

Seaborn does not have the explicit methods for setting labels. Seaborn 没有设置标签的明确方法。 Use matplotlib along with seaborn and it should work.将 matplotlib 与 seaborn 一起使用,它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM