2 ms·
These are really nice plots for the web. For publication it's quite essential for me to produce pdf charts with the text rendered with LaTeX. I use python's mat
by leni536 12y ago
These are really nice plots for the web. For publication it's quite essential for me to produce pdf charts with the text rendered with LaTeX. I use python's matplotlib for that. Can ggplot do something like this? That would be really nice.
- ArnoVanLumig 12y agoYou can do it with ggplot2 using the 'extrafont' library and installing the CM fonts (after loading extrafont, do 'font_install("fontcm")'). Then it's just adding + theme(text=element_text(family="CM Roman")) to your plot. For me that doesn't work when displaying the graphs in a window, but it does work when exporting to PDF with ggsave. Afterwards you have to embed the CM font into the PDF with 'embed_fonts'.
- minimaxir 12y agoThe tikzGraphics package (http://www.rforge.net/doc/packages/tikzDevice/tikz.html http://www.rforge.net/doc/packages/tikzDevice/tikz.html) can convert R charts to LaTeX equivalents. Whether or not it actually works well with ggplot2 is TBD.