Matplotlib is a powerful Python library for creating static, animated, and interactive visualizations. Here are some common example types and their usage:
1. Line Chart 📊
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 1])
plt.title("Simple Line Plot")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()
2. Bar Graph 📊
plt.bar(["A", "B", "C"], [10, 20, 15])
plt.title("Bar Chart Example")
plt.show()
3. Scatter Plot 📊
plt.scatter([1, 2, 3], [4, 5, 1], color="red")
plt.title("Scatter Plot Demo")
plt.show()
4. Pie Chart 📊
plt.pie([10, 20, 30], labels=["X", "Y", "Z"])
plt.title("Pie Chart Illustration")
plt.show()
For more tutorials on Matplotlib basics, visit our Matplotlib Fundamentals Guide. Happy plotting! 🎉