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