I’ve always struggled with using plotmath via the expression function in R for adding mathematical notation to axes or legends. For some reason, the most obvious way to write something never seems to work for me and I end up using trial and error in a loop with far too many iterations.
So I am very happy to see the new latex2exp package available which translates LaTeX expressions into a form suitable for R graphs. This is going to save me time and frustration!
Here is a quick example showing a Lee-Carter decomposition of some mortality data.
The results are still a little ugly, but that is because of the limitations of base graphics in R. To get something more LaTeX-like, the tikzDevice package can be used as follows.