Step-by-Step Execution:
Importing Matplotlib
import matplotlib.pyplot as plt
This imports the pyplot module from Matplotlib, which is used for plotting graphs.
Plotting the Data
plt.plot([1, 2, 3], [4, 5, 6], 'ro')
The plot() function is used to create a graph.
[1, 2, 3] are the x-values.
[4, 5, 6] are the y-values.
'ro':
'r' → Red color.
'o' → Circular markers (dots), meaning no lines will be drawn.
Displaying the Graph
plt.show()
This displays the plot in a window.
Final Output:
A) Red dots plot
0 Comments:
Post a Comment