How do I write a Latex formula in the legend of a plot using Matplotlib inside a .py file? How do I write a Latex formula in the legend of a plot using Matplotlib inside a .py file? python python