emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refresher on including R/ggplot2 output via latex/pdf?


From: Dominique Dumont
Subject: Re: Refresher on including R/ggplot2 output via latex/pdf?
Date: Mon, 28 Oct 2019 09:21:08 +0100

On Monday, 28 October 2019 05:16:00 CET John Hendy wrote:
> I just went to use what I think is how I used to include ggplot2
> results in PDF experts, but it's not working.
[...]
> My test file:
> -----
> * test
> 
> #+begin_src R :results output graphics :exports results :file foo.png
> library(ggplot2)
> 
> df <- data.frame(x=c(1, 2), y=c(2, 4))
> p <- ggplot(df, aes(x = x, y = y)) + geom_point()
> print(p)
> #+end_src

I had a similar issue to get plots in a revealjs export. Long story short, I 
solved the issue by adding these instructions at the end of the R script:

 grid::grid.newpage()
 grid::grid.draw(p)

Hope this helps





reply via email to

[Prev in Thread] Current Thread [Next in Thread]