emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Refresher on including R/ggplot2 output via latex/pdf?
@ 2019-10-28  4:16 John Hendy
  2019-10-28  4:32 ` Jack Kamm
  2019-10-28  8:21 ` Dominique Dumont
  0 siblings, 2 replies; 15+ messages in thread
From: John Hendy @ 2019-10-28  4:16 UTC (permalink / raw)
  To: emacs-orgmode

Greetings,

I used to use orgmode + R/ggplot2 for some time, but for various
reasons I've been using python almost exclusively for a couple years.
I just went to use what I think is how I used to include ggplot2
results in PDF experts, but it's not working.

In referring to the documentation, this is listed as an example:
- https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html#org046a0ff

* does produce a file, by using :results output
#+begin_src R :file 3.png :results output graphics
library(lattice)
xyplot(1:10 ~ 1:10)
#+end_src

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'm using emacs -Q, followed by M-x load-file RET path/to/min-config:
-----
;; set load paths
;; set load dirs and global config options
(add-to-list 'load-path "~/.elisp/org/lisp/")
(add-to-list 'load-path "~/.elisp/org/contrib/lisp/")
(add-to-list 'load-path "~/.elisp/ess/lisp/")

(require 'ess-site)

; setup babel languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)))
-----

M-x org-version: Org mode version 9.2.4 (release_9.2.4-381-g226363 @
/home/jwhendy/.elisp/org/lisp/)

When I run the code, the #+RESULTS: output is just blank. foo.png *is*
generated, but the file link ([[foo.png]]) I'd expect is not getting
inserted. It also, unsurprisingly, does not show in the file.

Hmmm. One last hail Mary google incantation before I sent this off
suggests that perhaps it's :results file now? Or :results graphics
file?
- https://stackoverflow.com/questions/50054520/python-vs-r-in-org-mode-babel-output-graphics

Thanks for any pointers. I'd be happy to assist with updated
documentation if the earlier link is now outdated/incorrect.


Best regards,
John

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-11-30 19:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-28  4:16 Refresher on including R/ggplot2 output via latex/pdf? John Hendy
2019-10-28  4:32 ` Jack Kamm
2019-10-28  4:40   ` John Hendy
2019-10-28  5:03     ` Jack Kamm
2019-10-28  5:13       ` John Hendy
2019-10-28  6:15         ` Jack Kamm
2019-10-28  7:43           ` John Hendy
2019-10-28 16:21             ` Berry, Charles
2019-10-28 16:30               ` John Hendy
2019-10-28 17:46                 ` Jack Kamm
2019-10-29 14:39                   ` John Hendy
2019-10-29 14:50                     ` Jack Kamm
2019-10-29 15:13                       ` John Hendy
2019-11-30 19:21                 ` Jack Kamm
2019-10-28  8:21 ` Dominique Dumont

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).