Graphing single function
To plot a function in Matplotlib:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(-np.pi, np.pi, 100)
y = np.sin(x)
fig, ax = plt.subplots()
ax.grid()
ax.set_xlabel(r'\(x\)')
ax.set_xticks([-np.pi, 0, +np.pi])
ax.set_xticklabels([r'\(-\pi\)', '0', r'\(\pi\)'])
ax.set_ylabel(r'\(y = \sin(x)\)')
ax.set_yticks([-1, 0, +1])
ax.set_title('The sine function.')
ax.plot(x, y)
fig