简体   繁体   中英

seaborn horizontal bar plot not showing plot

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)

在此处输入图像描述

With orient :

在此处输入图像描述

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')

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM