fig2tex | R Documentation |
Creates two files (.tex and .png); the .png file contains the figure (ggplot) that is submitted and the .tex file contains the snipped to load the figure use (\inputfile.tex in your TeX document) to include the figure with the caption.
fig2tex(g, fileGraph, caption, ...)
g |
figure of class ggplot |
fileGraph |
file name to save figure |
caption |
caption for figure |
... |
parameters passed to ggsave() such as dpi,width |
Thomas Gredig
raw.texArticle
q = tempdir()
x=seq(-10,10,0.1); y=x^2-2
g = ggplot2::ggplot(data.frame(x,y), ggplot2::aes(x,y)) +
ggplot2::geom_point(col='red') + ggplot2::theme_bw()
fig2tex(g, file.path(q,"test.png"), "First Graph.")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.