0

I can plot a normal bar plot with searborn, but when i specify orient = 'h' nothing shows up in my plot.

df = pd.DataFrame(['A','A','A','B','B','C'],columns = ['letters'])
data =df.letters.value_counts()
sns.barplot(x = data.index, y = data)

enter image description here

With orient:

enter image description here

0

1 Answer 1

6

You have to swap x and y when you change orientation.

df = pd.DataFrame(['A','A','A','B','B','C'],columns = ['letters'])
data =df.letters.value_counts()
sns.barplot(y = data.index, x = data, orient='h')

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.