← Computational Mathematical Biology

Matplotlib

Matplotlib creates scientific graphs for exploring data and presenting model results.

Plotting a model trajectory

import matplotlib.pyplot as plt

plt.plot(t, N)
plt.xlabel("Time")
plt.ylabel("Population")
plt.show()

Comparing model and data

plt.scatter(t_data, y_data, label="Data")
plt.plot(t_model, y_model, label="Model")
plt.xlabel("Time")
plt.ylabel("Observed quantity")
plt.legend()
plt.show()

Axes, units and legends should communicate the biological quantity clearly. Visual appearance should not obscure uncertainty or differences between observations and predictions.

Key idea. A scientific graph is part of the analysis: it should make the mathematical and biological meaning of the result easier to inspect.