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
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Advanced Plotting: H | Master Data Science with Python lesso | BraveProgrammer
  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 35 of 60

·python

Advanced Plotting: Histograms, Boxplots, and Violin Plots

20 minutes

Course progress58%

Advanced Plot Types

These plots are essential for summarizing distributions.

Histogram (frequency distribution)

data = np.random.randn(1000)
plt.hist(data, bins=30, edgecolor='black', alpha=0.7)
plt.title('Histogram of Normal Distribution')
plt.xlabel('Value')
plt.ylabel()
plt.show()
'Frequency'

Boxplot (quartiles and outliers)

# Compare two groups
group1 = np.random.normal(0, 1, 200)
group2 = np.random.normal(1, 1.5, 200)
plt.boxplot([group1, group2], labels=['G1', 'G2'], notch=True)
plt.title('Boxplot Comparison')
plt.ylabel('Value')
plt.show()

Violin plot (kernel density + boxplot)

import seaborn as sns
sns.violinplot(data=[group1, group2], palette='muted')
plt.title('Violin Plot')
plt.show()

KDE (kernel density estimate)

sns.kdeplot(data, shade=True, color='green')
plt.title('KDE Plot')
plt.show()

When to use which?

  • Histogram: quick view of frequency; easy to interpret.
  • Boxplot: median, quartiles, outliers.
  • Violin: detailed distribution shape.

Info

Combine a violin and a boxplot for richer insight (sns.violinplot(..., inner='box')).
Make it stickPractice what you've learned1 quiz · 4 practical tests · Optional activities from Master Data Science with PythonBrowse activities
Previous lessonSubplots, Grids, and LayoutsContinue to lesson 36Seaborn Overview: Statistical Data VisualizationBack to Master Data Science with Python curriculum