CHAPTER 19
Beginner
Data Visualization with Pandas
Updated: May 18, 2026
5 min read
# CHAPTER 19
Data Visualization with Pandas
1. Chapter Introduction
Pandas integrates with Matplotlib to enable visualization directly from DataFrames — one-line charts, subplots, styled figures. This chapter covers the essential chart types every data analyst needs.2. Setup
python
3. Line Chart
python
4. Bar Chart
python
5. Histogram and Distribution
python
6. Scatter Plot and Box Plot
python
7. Common Mistakes
-
plt.show()beforesavefig(): Alwayssavefig()beforeshow()—show()clears the figure.
-
Not using
tight_layout(): Labels and titles often overlap. Always callplt.tight_layout()before saving.
8. MCQs
Question 1
df.plot(kind='bar') creates?
Question 2
kind='barh' creates?
Question 3
kind='hist', bins=30 controls?
Question 4
kind='kde' shows?
Question 5
alpha=0.6 in plots?
Question 6
plt.style.use('seaborn-v0_8-whitegrid') applies?
Question 7
savefig() must be called?
Question 8
Box plot shows?
Question 9
Scatter plot is best for visualizing?
Question 10
plt.tight_layout() fixes?
9. Interview Questions
- Q: What chart type would you use to show the relationship between experience and salary?
- Q: How do you save a Pandas plot to a file?
10. Summary
Pandas.plot() wraps Matplotlib for quick charts. Key kind values: line, bar, barh, hist, kde, scatter, box. Always tight_layout() before savefig(). Use plt.style.use() for consistent aesthetics. For advanced plots, use Seaborn or Plotly.