0

I have a figure with two subplots, each of them with their legend to the right. I would like to replace the title of each legend with a PNG image. My code, very downstripped:

fig, axes = plt.subplots(nrows=2, ncols=1)

for ax in axes:
    # Add data and set up axes
    ...
    # Add legend
    lgd = ax.legend(loc='center right', ncol=1, borderaxespad=-10.0, fontsize=16, title='TITLE')
    

... where the value of the argument title would ideally be the image. Can this be done in a simple manner?

My question is related to this one, but it's a bit different in implementation (I am using ax.legend and not plt.legend), and also in concept (I need only the legend's title to be an image, and not all its elements). Also, I am hoping for a simpler solution.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
rdv
  • 682
  • 2
  • 8
  • 19

0 Answers0