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.

Line, Scatter, and B | Master Data Science with Python lesso | BraveProgrammer
  1. Courses
  2. /
  3. Master Data Science with Python

Lesson 32 of 60

·python

Line, Scatter, and Bar Charts

15 minutes

Course progress53%

Common Plot Types

We'll explore the most frequently used chart types.

Line chart (trend over time)

import pandas as pd
import matplotlib.pyplot as plt

time = pd.date_range(start='2024-01-01', periods=12, freq='M')
values = np.random.randn().cumsum()
plt.plot(time, values, marker=)
plt.title()
plt.xlabel()
plt.ylabel()
plt.grid()
plt.show()
12
'o'
'Monthly Trend'
'Month'
'Cumulative Value'
True

Scatter plot (relationship between two variables)

x = np.random.rand(100)
y = 2*x + np.random.randn(100)*0.2
plt.scatter(x, y, alpha=0.7)
plt.title('Scatter Plot')
plt.xlabel('Feature X')
plt.ylabel('Target Y')
plt.show()

Bar chart (categorical comparison)

categories = ['A', 'B', 'C', 'D']
counts = [23, 45, 12, 30]
plt.bar(categories, counts, color='skyblue')
plt.title('Bar Chart of Categories')
plt.xlabel('Category')
plt.ylabel('Count')
plt.show()

When to use which?

  • Line: trends over ordered axis (time, distance).
  • Scatter: explore correlation, detect outliers.
  • Bar: compare discrete groups.

Info

You can customize colors, markers, and transparency to improve readability.
Make it stickPractice what you've learned1 quiz · 4 practical tests · Optional activities from Master Data Science with PythonBrowse activities
Previous lessonMatplotlib Basics: Plotting with PythonContinue to lesson 33Customizing Plots: Styles, Labels, Legends, and ThemesBack to Master Data Science with Python curriculum