0% found this document useful (0 votes)
1 views1 page

Matplotlib

Uploaded by

Sourabh Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

Matplotlib

Uploaded by

Sourabh Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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)

You might also like