Jonathan Bechtel
Jonathan Bechtel

Reputation: 3607

How To Prevent Plot Title From Overlapping With Chart in Pandas Boxplot

If I run the following code:

df.boxplot(column='Age', by='Embarked', grid=False)

I get the following chart:

enter image description here

How does one change the padding on either the chart of the title so they don't overlap?

Upvotes: 0

Views: 1709

Answers (1)

Quang Hoang
Quang Hoang

Reputation: 150735

I experienced the same problem with the usual

df.boxplot(column='Age', by='Embarked', grid=False)
plt.show()

However, I was able to separate the headers by passing an axis:

fig, ax = plt.subplots(figsize=(12,8))
df.boxplot(column='Age', by='Embarked', ax=ax, grid=False)
plt.show()

Output:

enter image description here

Upvotes: 2

Related Questions