arnavlohe15
arnavlohe15

Reputation: 334

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?

Upvotes: 1

Views: 6330

Answers (1)

Anurag Reddy
Anurag Reddy

Reputation: 1225

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.

Upvotes: 2

Related Questions