emacs-orgmode
[Top][All Lists]
Advanced

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

Images generated by R code blocks do not display


From: William Denton
Subject: Images generated by R code blocks do not display
Date: Tue, 22 Nov 2022 16:18:18 -0500 (EST)
User-agent: Alpine 2.22 (DEB 394 2020-01-19)

I have a problem with images made by R code blocks in Org: not being displayed or refreshed. (This has been going on for a while, but I can't remember when it started.) Here's a minimal reproducible example I hope others can check. It requires R on your system and the ESS package.

First, here's my minimal-init.el file:

#----- minimal-init.el
  (setq debug-on-error t
        debug-on-signal nil
        debug-on-quit nil)

  (add-to-list 'load-path (expand-file-name "/usr/local/src/org-mode/lisp"))

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

  (add-to-list 'load-path "~/.emacs.d/elpa/ess-20221121.1627") ;;  
"/usr/local/src/ESS/lisp"
  (require 'ess-r-mode)
# -----

For me this runs Org from the source tree (up to date today) and ESS from where it was installed (package updated yesterday, as it happens). Adjust paths as necessary.

Next, here is r.org, with one R code block that makes a simple chart:

# ----- r.org
  #+begin_src R :results graphics file :file /tmp/plot.png :width 300 :height 
300
  plot(c(1, 2, 3, 4), c(1, 8, 27, 64))
  #+end_src
# -----

Run Emacs:

$ emacs -Q -l minimal-init.el

In Emacs:

+ C-x C-f (load r.org wherever it is)
+ C-c C-c (to execute the R code)
+ Say yes to "Evaluate this R code block on your system?"
+ #RESULTS block appears (good) but image does not show
+ C-c C-x C-v (to toggle image display)
+ image appears
+ C-c C-c (to execute R code again)
+ Say yes to "Evaluate this R code block on your system?"
+ image disappears
+ C-c C-x C-v says "Inline image display turned off"
+ C-c C-x C-v says "Inline image display turned off" (and so on)

Expected behaviour: Images should appear when this code block is run or rerun, and C-c C-X C-v (org-toggle-inline-images) should toggle the setting, not keep it off.

Thanks,

Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



reply via email to

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