Violin Plot
Tue Nov 19 2024 02:51:44 GMT+0000 (Coordinated Universal Time)
Saved by
@login123
#8. Violin Plot
#Violin plots are used to show the distribution of data across different categories.
# Example: Violin plot for Sales in different regions
import seaborn as sns
# Sample data for different regions
data = {
'Region': ['North', 'East', 'West', 'South', 'North', 'East', 'West', 'South'],
'Sales': [12000, 15000, 17000, 13000, 16000, 19000, 18000, 15000]
}
df = pd.DataFrame(data)
sns.violinplot(x='Region', y='Sales', data=df)
plt.title("Violin Plot of Sales by Region")
plt.show()
content_copyCOPY
Comments