user9524120
user9524120

Reputation: 37

How to Rotate Count Plot In Seaborn?

plt.figure(figsize = (12, 8))
sns.set(style = 'dark', palette = 'colorblind', color_codes = True)
ax = sns.countplot('Position', data = data, color = 'orange')
ax.set_xlabel(xlabel = 'Different Positions in Football', fontsize = 16)
ax.set_ylabel(ylabel = 'Number of of Players', fontsize = 16)
ax.set_title(label = 'Comparison of Positions and Players', fontsize = 20)
plt.show()

After excuting this code the labels get Overlapped enter image description here

Is there any way to rotate the image to prevent overlapping?

Upvotes: 2

Views: 4157

Answers (1)

Grif
Grif

Reputation: 11

Insted of using

ax = sns.countplot('Position', data = data, color = 'orange')

Where 'Position' = x, try to use 'Position'=y, just like that:

ax = sns.countplot(y='Position', data = data, color = 'orange')

The rest of the code remains the same

Upvotes: 1

Related Questions