8000 Updated README · matplotlib/matplotlib@57728b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57728b5

Browse files
author
pavan-sai-santhosh
committed
Updated README
1 parent db83eff commit 57728b5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,43 @@ See the [install
3535
documentation](https://matplotlib.org/stable/users/installing/index.html),
3636
which is generated from `/doc/install/index.rst`
3737

38+
## Quick Example
39+
40+
Here's a simple example to plot a line chart using Matplotlib:
41+
42+
```python
43+
import matplotlib.pyplot as plt
44+
45+
x = [1, 2, 3, 4]
46+
y = [10, 20, 25, 30]
47+
48+
plt.plot(x, y, marker='o')
49+
plt.title("Sample Line Plot")
50+
plt.xlabel("X-axis")
51+
plt.ylabel("Y-axis")
52+
plt.grid(True)
53+
plt.show()
54+
```
55+
Description:-
56+
57+
This example demonstrates how to create a simple line chart using Matplotlib in Python.
58+
We define two lists x and y, where:
59+
60+
x → Values plotted along the X-axis
61+
62+
y → Corresponding values on the Y-axis
63+
64+
Then:
65+
66+
plt.plot() draws the line graph and marks each data point with circles (marker='o').
67+
68+
plt.title(), plt.xlabel(), and plt.ylabel() add a title and axis labels.
69+
70+
plt.grid(True) displays a background grid for better readability.
71+
72+
Finally, plt.show() renders the plot window.
73+
74+
3875
## Contribute
3976

4077
You've discovered a bug or something else you want to change — excellent!

0 commit comments

Comments
 (0)
0