Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 37 of 60 · python

Seaborn Categorical Plots: Bar, Box, and Violin

Duration: 15 minutes

Categorical Plots with Seaborn

Seaborn's high‑level API makes it easy to visualize categorical data.

Bar plot (mean with confidence interval)

sns.barplot(x='species', y='sepal_length', data=iris, ci=95)
plt.title('Mean Sepal Length by Species')
plt.show()

Box plot (distribution per category)

sns.boxplot(x='day', y='total_bill', hue='sex', data=sns.load_dataset('tips'))
plt.title('Total Bill by Day and Gender')
plt.show()

Violin plot (categorical + KDE)

sns.violinplot(x='species', y='petal_width', data=iris, palette='pastel')
plt.title('Petal Width Distribution')
plt.show()

Swarm plot (individual observations)

sns.swarmplot(x='day', y='total_bill', data=sns.load_dataset('tips'))
plt.title('Individual Bills by Day')
plt.show()

Combination: violin + strip

sns.violinplot(x='species', y='sepal_width', data=iris, inner=None)
sns.stripplot(x='species', y='sepal_width', data=iris, color='k', size=3, jitter=True)
plt.show()

Info

Use hue to add a second categorical dimension (e.g., gender, month).

Previous: Seaborn Overview: Statistical Data VisualizationNext: Seaborn Regression Plots