Data Visualization with Matplotlib and Seaborn

Data Science 271 views Nov 14, 2025 1 min read

Introduction

Data visualization helps communicate insights and understand trends. Matplotlib and Seaborn are the most widely used Python visualization libraries.

1. Line Plot


import matplotlib.pyplot as plt

plt.plot(df["year"], df["sales"])
plt.xlabel("Year")
plt.ylabel("Sales")
plt.show()
  

2. Bar Chart


plt.bar(df["department"], df["salary"])
  

3. Histogram


plt.hist(df["age"], bins=10)
  

4. Box Plot


sns.boxplot(x=df["salary"])
  

5. Heatmap


sns.heatmap(df.corr(), annot=True, cmap="coolwarm")
  

6. Scatter Plot


plt.scatter(df["height"], df["weight"])
  

7. Pair Plot


sns.pairplot(df)
  

Conclusion

Data visualization is essential for EDA and communicating findings. Matplotlib is great for basic plots, while Seaborn offers advanced visualizations.

Some advanced sections are available for Registered Members
Share this Post
🚀 Want to Test Your Knowledge?

Take quizzes related to this topic and see where you stand!

Start Quiz Now
Back to Tutorials