This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 9: Matplotlib

Add a title

face William Hunter Josiah Wang

Task 2: Give yourself a title!

Now, add a title to the graph. Make the title 'My Graph'.

See this official documentation for a hint on how to do this.

Add a title

import numpy as np
import matplotlib.pyplot as plt

resolution = 1000
x = np.linspace(0, 50, resolution)
y = np.sin(x)
z = np.exp(y)

plt.figure(1)
plt.plot(x, y)
plt.title("My Graph")
plt.show()