Chapter Summary
Chapter Summary
Key Points
- 1.
Use the OO API, not pyplot. Always create figures with
fig, ax = plt.subplots()and call methods onax. This avoids state leaks, enables reusable plotting functions, and composes cleanly into multi-panel figures. Reserveplt.plot()for throwaway REPL sessions only. - 2.
Master the core trio: line, scatter, and error bars.
ax.plot()for connected curves,ax.scatter()for per-point color/size variation,ax.errorbar()for confidence intervals. Useax.fill_between()for shaded confidence bands. Always show uncertainty — a BER curve without error bars is scientifically incomplete. - 3.
Image plots need correct colormaps and origin. Use
viridisor another perceptually uniform colormap — neverjet. Setorigin='lower'for physical data (spectrograms, channel matrices). Add a colorbar with units. Usepcolormeshfor non-uniform grids. - 4.
Set figsize to the final print size. For IEEE single-column, use
figsize=(3.5, 2.625)with 8pt fonts and 600 DPI. The figure should look correct at 100% zoom — never rely on post-export scaling. Export as PDF or SVG for vector quality. - 5.
Complex data needs dual plots or constellations. Use magnitude/phase (Bode) plots with
np.unwrap()for frequency responses. Use scatter plots withaspect='equal'for constellation diagrams. HSV coloring maps phase to hue for 2D complex fields.
Looking Ahead
Chapter 16 extends your 2D visualization toolkit with Seaborn for statistical plots, Plotly for interactivity, animations for time-varying data, and domain-specific plot types like Smith charts and eye diagrams.