Several Charts in One Figure
Related charts read best side by side. plt.subplots(rows, cols) makes a grid of axes. With one row or one column you get a simple list; with both you get a grid you index as axs[row][col]. Add figsize=(width, height) in inches to control the size, and call fig.tight_layout() so titles and labels do not overlap.
Pass sharey=True when the charts use the same unit, so the eye can compare them without re-reading the scale.
Examplepython
Quick check
What does `plt.subplots(2, 2)` give you?
Your turn: write the code
Make a figure with 1 row and 2 columns of axes and print how many axes the figure has (use len(fig.axes)).
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.