Python Forum
Dataframe.hist() labels overlapping graphs - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Dataframe.hist() labels overlapping graphs (/thread-23685.html)



Dataframe.hist() labels overlapping graphs - RawlinsCross - Jan-12-2020

Good day,

I have a csv file that has a header row. When I put it into a dataframe and run the .hist() I get a the labels for the individual graphs overlapping all the graphs. Is there anyway to label the graphs in a neater manner?

from pandas import read_csv
from matplotlib import pyplot
# define the dataset location
filename = 'Nickel.csv'
# load the csv file as a dataframe
dataframe = read_csv(filename, header=0)
# create a histogram plot of each variable 
dataframe.hist()
pyplot.show()



RE: Dataframe.hist() labels overlapping graphs - Larz60+ - Jan-12-2020

please supply a sample of Nickel.csv (if large just a samll part please)
so code can be run


RE: Dataframe.hist() labels overlapping graphs - RawlinsCross - Jan-14-2020

Hey Larz, thanks for getting back. So I had a dataset with 10 columns of data and the subplots of histograms had all sort of overlapping of titles with the graphs when using jupyter.

Ended up fixing it with the tight_layout method.

pyplot.tight_layout()
pyplot.show()