write a Python program to plot the function Y = x ^2 using the pyplot or matplotlib libraries.
plzz do it fast !
Answers
Answered by
14
Answer:Getting started ( Plotting a line)
# importing the required module
import matplotlib.pyplot as plt
# x axis values
x = [1,2,3]
# corresponding y axis values
y = [2,4,1]
# 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 graph!')
# function to show the plot
plt.show()
Output:
mp1
Explanation:
Answered by
21
Answer:
See below.
Explanation:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange( -10 , 10 )
y = np.square( x )
plt.plot( x , y )
plt.show()
Similar questions