How to plot the top 5 values that appear to be the biggest in this plot? (Wii
,NES
,GB
,DS
,X360
)
sns.violinplot(x=df['Global_Sales'],y=df['Platform'],data=df)
CodePudding user response:
Use sort_values
with tail
:
sns.violinplot(
x='Global_Sales',
y='Platform',
data=df.sort_values('Global_Sales').tail(5))
Or sort_values(ascending=False)
with head
:
sns.violinplot(
x='Global_Sales',
y='Platform',
data=df.sort_values('Global_Sales', ascending=False).head(5))