R

Useful Utilities

Embed Fonts in PDF Figures generated using ggsave are not guaranteed to embed into the file. Although R comes with utility function (in the grDevices) embedFonts() and the extraFonts has a function embed_fonts() for the same purpose. However, sometimes both still fail to embed the font into the document. This blog plot provides a much more robust solution based on ghostscript, which is only accessible via the command line interface.

Do you really need a plot with a second axis?

In her book, Story telling with data, Cole Nussbaumer Knaflic states Sometimes it’s useful to be able to plot data that is in entirely different units against the same x‐axis. This often gives rise to the secondary y‐axis: another vertical axis on the right‐hand side of the graph. When interpreting Fig. 1, it takes some time and reading to understand which data should be read against which axis. Because of this, you should avoid the use of a secondary or right‐hand y‐axis.