Filip.Snailer
Filip.Snailer

Reputation: 33

Removing label in Boxplot in Python

I'm unable to remove the label "Age" under each box plot shown below. Its autogenerated and can't get rid of it. Here is my code and output:

dataset.boxplot(column=['Age'], by=None, ax=None, fontsize=None, rot=0, 
grid=True, figsize=None, layout=None, return_type=None)
plt.suptitle('Attrition by Age')
plt.xlabel('test')
plt.title('test6')
plt.subplot(121)
plt.xlabel('test2')
plt.title('test3')
plt.ylabel('test5')

enter image description here

Upvotes: 2

Views: 5708

Answers (1)

Jallyfish
Jallyfish

Reputation: 96

This is because here "Age" is not an axis label, instead it is a tick. So you can add something like this:

     plt.xticks([1], [''])

to remove the first tick. And there are many other ways to remove or change ticks. For example, this post describes how to remove ticks on different axes.

Upvotes: 6

Related Questions