Visualising Scientific Data
Visualisation turns raw computational output into physical insight, revealing patterns that flat numbers hide.
import matplotlib.pyplot as plt
import numpy as np
t = np.linspace(0, 2*np.pi, 200)
plt.plot(t, np.sin(t), label="sin(t)")
plt.xlabel("Time (s)"); plt.ylabel("Amplitude")
plt.legend(); plt.grid(True); plt.show()
Essential plot types for physics
| Plot | Use Case |
|---|---|
| Line plot | Time series, trajectories |
| Scatter | Experimental data points |
| Histogram | Measurement distributions |
| Contour | 2D scalar fields |
| Vector | Force / velocity fields |
Best Practices & Pitfalls
A clear plot communicates science cleanly, while bad practices distort the truth.
- Always label axes with units.
- Use a legend for multiple series.
- Add error bars:
plt.errorbar(x, y, yerr=err). - Save as vector (
.pdf) for publications.
Common Pitfall: Axis choices manufacture or hide stories. Truncated y-axes exaggerate trends, and log scales linearise exponentials. Always read the axes before believing any plot.