y = np.random.randn(100)
y2 = np.random.randn(100)
s = plt.scatter(x, y, c='b')
s2 = plt.scatter(x, y2, c='r')
custom_handler = ImageHandler()
custom_handler.set_image('[PATH TO IMAGE]', image_stretch=(0, 20))
plt.legend([s, s2], ['Scatters 1', 'Scatters 2'], handler_map={s:
    custom_handler, s2: custom_handler}, labelspacing=2, frameon=False)
Insert image in matplotlib legend