[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Refresher on including R/ggplot2 output via latex/pdf?
From: |
John Hendy |
Subject: |
Re: Refresher on including R/ggplot2 output via latex/pdf? |
Date: |
Sun, 27 Oct 2019 23:40:34 -0500 |
On Sun, Oct 27, 2019 at 11:31 PM Jack Kamm <address@hidden> wrote:
>
> Your code block looks fine to me. The typical R code block headers I use is
> as follows:
Did you try to reproduce my example, by chance?
> :session :results output graphics :file path/to/file.png :exports results
> :eval never-export
Using this:
-----
#+begin_src R :session :results output graphics :file foo.png :exports
results :eval never-export
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 get an empty #+RESULTS: header, but no inserted file link. The plot
is not in the exported PDF either.
If I make it this:
-----
#+begin_src R :session :results file graphics :file foo.png :exports
results :eval never-export
-----
I get the expected results, and the plot is in the output PDF.
-----
#+RESULTS:
[[file:foo.png]]
-----
> One thing I've noticed, if I have an existing graphics device open, it
> can mess up plots when executing an org-babel cell. Calling dev.off() a
> few times fixes this for me.
>
> Note I pretty much always use R blocks with the :session argument,
> things might be pretty different without it.
I usually use :session as well (and have it in my actual document, but
left it off for this test case). Still, using your header (minus
changing the file path/type) didn't work for me.
Thanks for taking a look,
John
- Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Jack Kamm, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?,
John Hendy <=
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Jack Kamm, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Jack Kamm, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Berry, Charles, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Jack Kamm, 2019/10/28
- Re: Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/29
- Re: Refresher on including R/ggplot2 output via latex/pdf?, Jack Kamm, 2019/10/29
- Re: Refresher on including R/ggplot2 output via latex/pdf?, John Hendy, 2019/10/29