figures from ggplot2 to pictex

The ggplot2 R package recognises the tex extension and it allows to export the data graphics to latex documents. The tex output doesn’t look like the original file but with a little code editing we can get a quite good figure. Here is an example of the original and the exported line graphic once retouched.

graf_lin

disp <− qplot(date, unemploy / pop, data = economics, geom = "line")
disp
theme_set(theme_bw())
disp + theme(panel.grid.major = element_line(colour = "white"), panel.border = element_rect(colour = NA))
ggsave(filename = "graf_lin.tex", scale=2, width = 10, height = 5, units = "cm", dpi = 300)

pictex

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

Post Navigation