I know there is a way to TeX inside the legend, but it doesn't understand arguments such as a line break or the matrix environment. I haven't been able to find any other resources that address drawing out a small matrix inside the legend itself, or even overlaying the matrix onto the plot.
This is the best I can get:
with this code:
plt.plot(perturbation, errors,label=r'$A=[ 3 2 ][ 4 3 ]$')
plt.legend(loc='upper left', prop={'size': 12})
Thanks for any suggestions!