'How to change formatting of Line chart axis

I'm doing a time series analysis using the following code using seaborn in python,

df['Crop'] = pd.Categorical(df['Crop'], categories=df['Crop'].dropna().unique())
pd.to_datetime(df['DisplayDate'], format='%y-%m-%d')
cols = df['Gr']

fig, axes = plt.subplots(len(cols), figsize=(6,3))
sns.lineplot(data=df, x= df['DisplayDate'], y= df['Crop'], hue= df['Gr'])
plt.show()

the graph comes out with scribbles in the x-axis like this:

enter image description here

My thought is that i might be due to the size of the dates. Is there a way to change the formatting of the x-axis so that instead of showing the entire date, it only shows the month?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source