[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] problems with R graphics
From: |
Matthew Landis |
Subject: |
Re: [O] problems with R graphics |
Date: |
Thu, 1 Mar 2012 02:47:09 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Matthew Landis <landis <at> isciences.com> writes:
>
> Hello all,
...
> Unfortunately, I can't seem to get graphics
> to insert themselves properly on export.
....
> org example
> ----------------------------
...
> * A stand-alone code block
>
> First, create some data, perform a regression, and plot it. This
> works great.
> #+begin_src R :results graphics :file regress.png :exports both
>
> x <- runif(n = 100, min = 0, max = 20)
> y <- 5*x^2 + 0.3*x + 3 + rnorm(100, sd = 200)
>
> f <- lm(y ~ x)
>
> plot(x, y, bty = 'n')
> abline(f, lty = 'dashed')
>
> #+end_src
> Success.
...
> #+begin_src R :session :results graphics :file regress_session.png :exports
both
>
> plot(x, y, bty = 'n')
> abline(f, lty = 'dashed')
>
> #+end_src
> This code block doesn't work. No error, but no file is created.
...
I actually figured this one out just now. If creating a file in a 'stand
alone'
code block, the default directory is the directory that the org file itself is
in. However, in a 'session' code block, the default directory is something
else
(R's default?). If I specify the full path to the file in the 'session' code
block, things work better.
Sorry for the noise!
M