Module 10

Labels and axes

Making plots readable.

Annotating your plot

A good plot has a title and labeled axes. Use title(), xlabel(), and ylabel().

Python
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [10, 20, 15])
plt.title("Gene expression")
plt.xlabel("Sample")
plt.ylabel("Expression")
plt.savefig("labeled.png")
print("Labeled plot saved")
Labeled plot saved
Your task

Add labels

  • Add title and axis labels to a plot.