When you are working with latex formulas, it is often nice to add them to your Matplotlib plots as it can greatly improve readability.
This is especially true when you already are working with latex and want to keep consistent writing across your paper.
Here is the code
Matplotlib comes with native support for latex.
Like if you were to write it in Markdown, you will have to use the dollar sign ($) to open and close your formulas. (e.g. \cos_x => $\cos_x$)
The result
Here you are! You now know how to write latex formulas in a Matplotlib plot.