Plot a labelled line on the first panel of a 1×2 grid, then collect its handles…
Matplotlib · from Making it fit
layout="constrained"fig.tight_layoutfig.suptitlefig.supxlabelfig.legendsubplots_adjustPutting the kettle on…
Starting up…
Exercise 3
Plot a labelled line on the first panel of a 1×2 grid, then collect its handles with get_legend_handles_labels() and put one legend on the figure. Return len(fig.legends).
your answer
stuck? the lesson behind it
Making it fit
constrained layout, figure-level labels, and one legend for the lot