简体   繁体   中英

Creating Axis Labels on Seaborn Countplot

I want to add axis labels to a Seaborn countplot I have created using the following code:

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:

#.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?

Do

import matplotlib.pyplot as plt

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

Seaborn does not have the explicit methods for setting labels. Use matplotlib along with seaborn and it should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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