# Creating a simple triangle using matplotlib
"""
Before executing the program install matplotlib
open command prompt and type
pip install matplotlib
this will install all required packages
"""
# importing the required module
import matplotlib.pyplot as plt
# x axis values
x = [1,2,3,1]
# corresponding y axis values
y = [2,4,1,2]
# plotting the points
plt.plot(x, y)
# naming the x axis
plt.xlabel('x - axis')
# naming the y axis
plt.ylabel('y - axis')
# giving a title to my graph
plt.title('My first Triangle!')
# function to show the plot
plt.show()
Output:
No comments:
Post a Comment
Don't be a silent reader...
Leave your comments...
Anu