import matplotlib.pyplot as plt import numpy as np # create an array of x-values x = np.arange(-3, 3, 0.01) # see just how many values of x we just created print len(x) # calculate an array of y values as a function of x-values y = (x-2)*(x+2)*(x-1) # plot the quadratic function of y as a function of x # # first, create a figure window fig1 = plt.figure() # # next, plot y as a function of x plt.plot(x, y) # # annotate the plot with grid lines, a title, and axis labels plt.title('My very first plot in Python. Yipee!!!') plt.grid(True) plt.xlabel('Input values (x)') plt.ylabel('Output Values (y)') # # finally, "show" the plot in the figure window plt.show()