f = plt.figure(figsize=(20, 10))
gs = gridspec.GridSpec(4, 2)
ax0 = plt.subplot(gs[0, 0])
ax1 = plt.subplot(gs[0, 1])
ax2 = plt.subplot(gs[1, 1])
ax3 = plt.subplot(gs[1, 0])
ax4 = plt.subplot(gs[2, 0])
ax5 = plt.subplot(gs[2, 1])
ax6 = plt.subplot(gs[3, 1])
ax7 = plt.subplot(gs[3, 0])
axes = [ax0, ax1, ax2, ax3, ax4, ax5, ax6, ax7]
axes_twin = [ax.twinx() for ax in axes]
for param_set in results.keys():
for i, (ax, ax_twin) in enumerate(zip(axes, axes_twin)):
t_test_plot = np.random.uniform(low=0.0, high=1.0, size=100)
i_test_plot = np.random.uniform(low=0.0, high=1000, size=100)
d_test_plot = np.random.uniform(low=0.0, high=10, size=100)
ax.plot(t_test_plot, i_test_plot, color='lightgrey')
temp = ax_twin.plot(t_test_plot, d_test_plot, label=keys)
Приведенный выше код сгенерирует график, который выглядит следующим образом:

Я искал в stackoverflow и получил этот код, чтобы сделатьлегенда:
handles, labels = ax_twin.get_legend_handles_labels()
fig.legend(handles, labels, loc='upper center')
Но это никак не повлияло.
Вот что я хочу.Я сделал скриншот своего сюжета, сгенерировал легенду из другого сюжета и сфотографировал их:

Как я могу это сделать?