Matplotlib

Matplotlib Interview Q&A

1What is Matplotlib?
Answer: Python's foundational plotting library for static, animated, and interactive charts.
2Pyplot vs object-oriented API?
Answer: Pyplot is stateful quick plotting; OO API is explicit and scalable.
3Figure and Axes difference?
Answer: Figure is full canvas, Axes is an individual plot area.
4How create subplots?
Answer: Use plt.subplots() and configure shared axes/layout.
5Common chart types?
Answer: Line, bar, scatter, histogram, boxplot, heatmap (with extras).
6How customize style?
Answer: Set titles, labels, ticks, colors, legends, and style sheets.
7How save high-quality figures?
Answer: Use savefig() with dpi and bbox settings.
8When use twin axes?
Answer: When plotting different scales on same x-axis, used cautiously.
9How handle overlapping labels?
Answer: Rotate ticks, increase figure size, and use tight layout.
10Matplotlib vs Seaborn?
Answer: Matplotlib gives low-level control; Seaborn provides statistical defaults.
11How plot dates well?
Answer: Use date formatters/locators and avoid overcrowded tick marks.
12One-line Matplotlib summary?
Answer: Matplotlib is the control-first plotting backbone of Python data workflows.