Line Plots, Markers, Line Styles & Multiple Series0%
Line Plots, Markers, Line Styles & Multiple Series
Beginner12 min read•Updated: Jul 11, 2026
Line Plots, Markers, Line Styles & Multiple Series
Reading Time: 8 Mins | Level: Intermediate
1. When to Use Line Plots
Line plots are the gold standard for tracking continuous numerical measurements over ordered sequences—most commonly chronological time (hours, days, months, fiscal years).
2. Plotting Multi-Series Trends with Custom Styling
Python
import matplotlib.pyplot as plt
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
sales_2025 = [45, 52, 58, 65, 72, 80]
sales_2026 = [50, 60, 68, 79, 88, 98]
fig, ax = plt.subplots(figsize=(9, 5))
# Series 1: Dashed line with circle markers
ax.plot(months, sales_2025, label='FY 2025', color='#64748b', linestyle='--', marker='o', linewidth=2)
# Series 2: Solid line with square markers
ax.plot(months, sales_2026, label='FY 2026', color='#2563eb', linestyle='-', marker='s', linewidth=3)
ax.set_title('Year-over-Year Revenue Trajectory (in Lakhs INR)')
ax.set_xlabel('Month')
ax.set_ylabel('Net Revenue (Lakhs)')
ax.legend(loc='upper left', frameon=True)
ax.grid(True, linestyle=':', alpha=0.6)
plt.show()
Interactive Quiz
Multiple Choice Questions
Question 1
Which parameter in
ax.plot() controls whether a line is solid, dashed, or dotted?Question 2
What does
ax.legend() do?Question 3
Which marker code represents square points on a Matplotlib line?
Question 4
How can you make gridlines subtle and non-intrusive on a chart?
Question 5
What parameter shades the area between two line curves (e.g. to illustrate confidence intervals)?
Next Lesson
Bar Charts, Horizontal Bars & Stacked Bars
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
| Previous Lesson | Next Lesson |
|---|---|
| Matplotlib Anatomy: Figure, Axes, Subplots & Ticks | Bar Charts, Horizontal Bars & Stacked Bars |
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.