Visualizations

You generated data, cleaned it into a table, and analyzed the statistics. But you still haven’t seen the answer.

The final layer of the Science Stack is visualization. This is where we translate abstract arrays of numbers into patterns that the human brain can understand. In computational biology, a graph is not just a pretty picture for a slide deck; it is a diagnostic tool. A histogram can reveal if your simulation crashed; a scatter plot can show if your model is performing well.

Matplotlib

Just as NumPy is the foundation for calculation, matplotlib is the foundation for visualization in Python.

It is likely the oldest and most battle-hardened plotting library in the scientific ecosystem. It is not famous for being “easy” or “beautiful” by default. It is famous for being controllable.

Modern libraries (like Seaborn or Altair) are like digital cameras: they have an “Auto” mode that makes things look good instantly, but you can’t change much. Matplotlib is like a manual film camera. You have to manually set the focus, the aperture, and the shutter speed. It takes more code to draw a simple line, but you have atomic control over every single pixel.

For this course, you must use Matplotlib. We force you to learn the “hard way” first so that you understand exactly how a figure is constructed: layer by layer, axis by axis.

Key Idea: Figures are Objects In Matplotlib, a plot isn’t a picture; it’s a container of code objects. A “Figure” contains “Axes” (the plot area), which contains “Lines” and “Labels.” You modify the graph by modifying these objects programmatically, not by clicking and dragging.

Last updated on