Matplotlib: How to draw a straight line

আমি এখন একটি সরল রেখা (y =2x+5 ) আঁকবো পাইথনে matplotlib মডিউলটা  import করে।

# importing matplotlib module  
from matplotlib import pyplot as plt 
  
x = [0, 1, 2, 3] # x-axis values  
y = [5, 7, 9, 11] # Y-axis values

# Chart Labeling 
plt.title("Straight Line of y= 2x + 5")  
plt.xlabel('X axis')
plt.ylabel('Y axis')
plt.grid(True)
# Calling function to plot 
plt.plot(x,y) 
# Calling function to show the plot 
plt.show()

Output:
Straight Line

Leave a Reply

Your email address will not be published. Required fields are marked *