I have created a 3x3 subplots by using the pandas df.line.plot:
ax=df.plot.line(subplots=True, grid=True,layout=(3, 3), sharex=True, legend=False,ylim=[-5,25])
It returns 3x3 matrix of Axes objects. Now I want to create a joint legend for those subplots.
As the other post suggests I should use:
handles, labels = ax.get_legend_handles_labels()
fig.legend(handles, labels, loc='upper center')
The problem is I can't use it because I have no figure created here. I only have axes. How can I make it work?
I edited the post, because I thought I could create a figure and prescribe the axes, but I guess it came from my confusion on subject.