I was wondering if the output plots resulting from org-babel
blocks are customizable in size (how they appear in the org-mode
buffer, as in its dimensions X and Y). Thanks!
Asked
Active
Viewed 278 times
0

Emmanuel Goldstein
- 934
- 6
- 18
1 Answers
0
For controlling image size in org-mode, you can use:
#+attr_org: :width 300px
in the newest version of org mode, percentage is allowed:
#+attr_org: :width 50%

NickD
- 27,023
- 3
- 23
- 42

Tianshu Wang
- 1,724
- 4
- 7
-
Thanks, and where shall I include this line? after "#+begin_src R" or before "#:results"? Not clear. Thanks. – Emmanuel Goldstein Feb 23 '22 at 07:59
-
Also, how to set both height and width? Can't find height anywhere in the org manual. – Emmanuel Goldstein Feb 23 '22 at 08:08
-
1You will want to name your code blocks (with `#+name: foo`) in order for this to work for repeated evaluations. Otherwise, you will get new `#+results` sections and you will have to add the `#+attr` section (and delete the old crud) again and again. – NickD Feb 23 '22 at 12:35
-
1You are only able to set the width: the height is changed automatically keeping the aspect ratio of the image constant. – NickD Feb 23 '22 at 12:36
-
@NickD, Can you give an example? So the #+name comes first and below the #+begin_src R babel line? – Emmanuel Goldstein Apr 04 '22 at 08:03
-
That's correct: then the `#+RESULTS` block should be named as well with the same name. Subsequent evaluations will reuse that named results block, even if you add `#+attr:` lines before the results block. If you don't use named blocks, you'll get a *new* results block because the `#+attr:` line would make the old result block unreachable from the code block. – NickD Apr 04 '22 at 13:49