Paul Magwene <pmma...@gmail.com> wrote: > Hi All, > > I'm trying to get up to speed with org-mode and babel for doing > reproducible computational research. I'm just starting to play around > with simple examples, and I'm baffled by the following. > > This first example, when exported to HTML or LaTeX produces the > expected result -- a simply code block with one embedded figure. > > # Example 1. > > This is my R example: > > #+begin_src R :file z.png :results output graphics > plot(matrix(rnorm(100), ncol=2), type="l") > #+end_src > > Some intervening text... > > #+results: > [[file:z.png]] > > > However, this almost identical example, minus the intervening text > between the code and the results, doesn't include the figure: > > # Example 2 > > This is my R example: > > #+begin_src R :file z.png :results output graphics > plot(matrix(rnorm(100), ncol=2), type="l") > #+end_src > > #+results: > [[file:z.png]] > > > What gives here? Do I always need to have intervening text between the > source code and results in order to get a figure in the exported > document? >
You need an :exports both header: #+begin_src R :file z.png :results output graphics :exports both plot(matrix(rnorm(100), ncol=2), type="l") #+end_src I don't know how or why the intervening text affects anything, but it just smells like a red herring to me... Nick :-)