Axes.get_legend_handles_labels()
にて各AxesのHandleとLabelを取得し、マージした後に Axes.legend(handles, labels)
にて1つのAxesにて表示すると良いかと思います。
Python
1import matplotlib.pyplot as plt
2import numpy as np
3fig, ax = plt.subplots(1,3,figsize=(9,3))
4x = np.linspace(-np.pi/2, np.pi/2, 1000)
5ax[0].plot(x, np.sin(x), label='sin', c='r')
6ax[1].plot(x, np.cos(x), label='cos', c='b')
7ax[2].plot(x, np.tan(x), label='tan', c='g')
8ax[2].set_ylim(-10,10)
9handles = []
10labels = []
11
12# 3つのaxesのlegendをマージ
13for i in range(3):
14 handle, label = ax[i].get_legend_handles_labels()
15 handles.extend(handle)
16 labels.extend(label)
17# マージしたLegendを表示
18ax[0].legend(handles, labels)
19
20plt.show()