solarwindpy.plotting.tools.joint_legend
- joint_legend(*axes, idx_for_legend=-1, **kwargs)[source]
Create a combined legend for multiple axes.
- Parameters:
*axes (
matplotlib.axes.Axes) – Axes objects from which to collect legend handles and labels.idx_for_legend (int, optional) – Index of the axis (after flattening) on which to place the legend. By default the legend is placed on the last axis.
idx_for_legend=-1assumes that the last axis is on the right hand side of the figure.**kwargs – Extra keyword arguments forwarded to
Axes.legend().
- Returns:
legend
- Return type:
Examples
>>> fig, ax = subplots(1, 2) >>> ax[0].plot([1, 2], label='a') [<matplotlib.lines.Line2D object at 0x...>] >>> ax[1].plot([2, 3], label='b') [<matplotlib.lines.Line2D object at 0x...>] >>> joint_legend(ax[0], ax[1]) <matplotlib.legend.Legend object at 0x...>