Using a picture as a legend label

A typical plot for me includes some simple line curves and a legend attempting to describe what apparatus that curve belongs to. Often the labels I give seem clear to me at the time, but even returning a month later to the plot, I’ll be as lost as the next guy.

A few of my colleagues have been plotting curves, and then including a picture or diagram in place of a typical legend label. The picture or diagram is bordered by the color of the trace on the plot. I am fairly certain the plots are done in Matlab. The diagrams are simply dropped into a powerpoint deck and given a border that is matched as close as possible to the trace. I did some things like that back in graduate school.

Seems like it would be neat to have a way to do a legend in matplotlib that does something like this. I’m envisioning a regular axes with lines, scatter plots, etc. to the left and a column of graphics to the right. I would think this would be fairly doable using GridSpec or some of the similar layout. The place I could see getting hung up would be adding a color border to a picture that matches the trace and also doing the scaling to make it work all dynamically for different numbers of traces.