File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,43 @@ See the [install
3535documentation] ( https://matplotlib.org/stable/users/installing/index.html ) ,
3636which 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
4077You've discovered a bug or something else you want to change — excellent!
You can’t perform that action at this time.
0 commit comments