What is the main difference between the Axes interface and the pyplot interface in matplotlib?
The Axes interface works with explicit axes objects, giving more control and flexibility. The pyplot interface is state-based and simpler, managing figures and axes behind the scenes.
Click to reveal answer
beginner
How do you create a plot using the Axes interface?
You first create a Figure and Axes object using plt.subplots(), then call plotting methods on the Axes object, e.g., ax.plot(x, y).
Click to reveal answer
intermediate
What is a benefit of using the Axes interface over pyplot?
It allows precise control over multiple plots in the same figure and avoids confusion from pyplot's global state.
Click to reveal answer
beginner
Show a simple example of plotting a line using the pyplot interface.