Labels on x-axis are overlapping in bar plot. How to fix it?



Hello everyone
I am currently working on data exploration in python. I have imported seaborn library as sns. I want to plot a bar plot using sns.barplot(). But I have a large number of categories on my X-axis, 52 precisely. When I gave command

it plotted a bar plot correctly. Due to large number of categories on X-axis, the labels on X-axis are overlapping and I am unable to see anything clearly. Can anyone help me with this?


Hello Vikas,

you can use the ‘orient’ parameter in sns.barplot as ‘h’. This will make the graph as horizontal barplot and the axis won’t over lap.

sns.barplot(data.week_wise_sum, data.weekofyear, orient=‘h’)

Below is the figure on a simulated data.


Thanks a lot for the answer. It was helpful.