Matplotlib Cheatsheet (Python)
1. Importing
import [Link] as plt
2. Basic Line Plot
x = [1, 2, 3, 4]
y = [10, 20, 25, 30]
[Link](x, y)
[Link]("Line Plot")
[Link]("X-axis")
[Link]("Y-axis")
[Link]()
3. Line Styles, Markers, Colors
[Link](x, y, color='green', linestyle='--', marker='o', label='Line 1')
[Link]()
4. Bar Chart
[Link](['A', 'B', 'C'], [5, 7, 3], color='skyblue')
5. Scatter Plot
[Link](x, y, color='red', marker='x')
6. Histogram
[Link](data, bins=5, color='orange', edgecolor='black')
7. Pie Chart
[Link]([40, 35, 25], labels=['A', 'B', 'C'], autopct='%1.1f%%')
[Link]('equal')
8. Subplots
[Link](1, 2, 1); [Link](x, y)
[Link](1, 2, 2); [Link](['A','B'], [5,7])
9. Customize Appearance
[Link]("Title", fontsize=14)
[Link]("X-axis", fontsize=12)
[Link](True)
[Link](loc='upper right')
10. Save Plot
[Link](figsize=(8, 4))
[Link]("[Link]", dpi=300)