0

I have one figure with multiple subplots, and each subplot has the same number of lines (In my case it's 4 lines). How can I have one single legend (say, ['a', 'b', 'c', 'd'] ) on the side for all the subplots?

BTW, I plotted the subplot axes using

fig, ax_list = plt.subplots(rows, cols)

and then for each subplot

ax_list[0][0].plot()

enter image description here

LWZ
  • 11,670
  • 22
  • 61
  • 79
  • 1
    If you know for sure that each `subplot` has 4 of the exact same lines, why don't you simply add labels for one `subplot`, and put a legend for that somewhere on the side (see e.g. this great answer: http://stackoverflow.com/a/4701285/3581217)? – Bart Jun 28 '16 at 17:15
  • 2
    Alternatively, using `fig.legend()` might be an option: http://matplotlib.org/examples/pylab_examples/figlegend_demo.html – Bart Jun 28 '16 at 17:17

0 Answers0