subplots share legend code example
Example: matplotlib one legend for all subplots
handles, labels = ax.get_legend_handles_labels()
fig.legend(handles, labels, loc='upper center')
handles, labels = ax.get_legend_handles_labels()
fig.legend(handles, labels, loc='upper center')