pwtools.mpl.collect_legends¶
- pwtools.mpl.collect_legends(*axs)[source]¶
Collect legend data from multiple axes, return input for legend().
Examples
>>> from pwtools import mpl >>> from numpy.random import rand >>> fig, ax = mpl.fig_ax() >>> ax.plot([1,2,3], label='ax line') >>> ax.bar([1,2,3], rand(3), label='ax bar') >>> ax2 = ax.twinx() >>> ax2.plot([3,2,1], 'r', label='ax2') >>> ax.legend(*mpl.collect_legends(ax, ax2))