import matplotlib import matplotlib.pyplot as plt # Import module pyplot import numpy as np # Data for plotting t = np.arange (0.0, 2.0, 0.01) #numpy construct an array, between 0 and 2, in steps of 0.01 s = 1 + np.sin (2 * np.pi * t) #numpy calculated fig, ax = plt.subplots () # subplots set the canvas ax.plot(t, s) ax.set(xlabel='time (s)', ylabel='voltage (mV)', title = 'About as simple as it gets, folks') # Set FIG title, x and y axis name ax.grid () # grid is set, the default grid has to be provided in accordance with the following linear, color and width #ax.grid(True, linestyle = "-.", color = "r", linewidth = "1") fig.savefig ( "test.png") # save image plt.show()