Basics and Functions

Import

import matplotlin.pyplot as plt

Plot

x = np.arange(0,10)
y = 2 * x

plt.plot(x, y)

Basic Styles (optional)

plt.title('title')
plt.xlabel('x-axis')
plt.ylabel('y-axis')

plt.xlim(0, 10) # x starts at 0 and ends at 10

Save fig as a .png or .jpg

plt.savefig('fig.png')

Show

plt.show()