Every visualization in Matplotlib is a hierarchical tree of Artist objects. Mastering the anatomy of a Figure is the single most important conceptual leap to mastering data visualization.
The `Figure` is the entire image canvas. Inside it sits one or more `Axes` (the plotting area). The Axes contains 4 `Spines` (borders), 2 `Axis` (X & Y coordinate lines), `Ticks` (ruler tick marks), and `Labels`.
Figure: The entire window/canvas. Axes: The actual plot/chart box with data. Axis: The number-line dimension (X-axis or Y-axis).
fig = plt.figure() # Canvas
ax = fig.add_subplot() # Plot areaSpines are the 4 boundary lines enclosing the data area: top, bottom, left, and right.
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)Avoid the top errors and bad plotting practices that trip up new Python developers
Switch from abstract numbers to relatable Cricket, Cinema & Business charts
Write Matplotlib code to solve the objective and see your live plot render
Create an axes using `fig, ax = plt.subplots()`, plot `x=[1,2,3]` and `y=[10,20,30]`, and set title to 'Sales Trend' and xlabel to 'Quarter'.
✓ ax.set_title✓ ax.set_xlabelTest your understanding to unlock the lesson completion badge