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

python
seaborn
barplot

#1

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
sns.barplot(dg.weekofyear,week_wise_sum)

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?
Thanks


#2

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.


#3

Thanks a lot for the answer. It was helpful.