Change scale of a plot in seaborn(Python)?

datavisualization
matplotlib
python
seaborn
eda

#1

Hi guys, I have a plot like this :

As can be seen although some values dominate, there is still some trend in other values but the scale of Y-Axis is messing things up. How can we change scale in a seaborn visualisation? So that the visualisation can show the trend better.

The following is my code

import matplotlib.pyplot as plt
import seaborn as sns

sns.countplot(x=feature_name,data=train,hue="is_listened")
plt.show()

#2

@mohdsanadzakirizvi

You can try by adjusting the figure size before plotting.

fig = plt.figure(figsize=(20,20))
fig.add_subplot(1,1,1)
sns.countplot(x=feature_name,data=train,hue="is_listened")

Hope this helps.


#3

how to handle displaying the x axis labels, iv faced this issue many times.
Is there a way to plot only 10 categories or something like that ?
changing orientation doesnt help much many times
@shubham.jain


#4

I don’t think there is any direct way for this. Still, if you wish to accomplish this then you can subset your data by only choosing the categories whose value_counts is greater than a threshold value and then plotting it.