0

I'm doing some simple EDA and trying to display a grid of histograms results in histogram names overlapping x axis labels as seen on the below screenshot:

enter image description here

The code that I'm using:

import pandas as pd
import matplotlib.pyplot as plt


data = pd.read_csv('housing.csv')

plt.tight_layout() # this doesn't have any effect, I only added it, bc I thought it would fix the problem

_ = data.hist()

It's displayed the same if I use DataSpell or GoogleColab and any other tool.

Marek M.
  • 3,799
  • 9
  • 43
  • 93
  • 1
    `plt.tight_layout()` needs to be called after creating the main plot. It adjusts spacings to make sure the labels fit nicely, which can't be done before knowing the labels. – JohanC Oct 22 '22 at 10:45

0 Answers0