3

I need to plot data evaluated in org-mode. Referring to #+RESULTS: returns org-babel-ref-resolve: Reference ‘myResult’ not found in this buffer whereas referring to #+tblname: works.

    #+RESULTS: myResult
    | 2057-01-01 | 10 |
    | 2057-01-02 |  5 |
    | 2057-01-03 |  3 |
    | 2057-01-04 |  2 |

    #+name: myTable
    | 2057-01-01 | 10 |
    | 2057-01-02 |  5 |
    | 2057-01-03 |  3 |
    | 2057-01-04 |  2 |

Note the failing reference data=myResult, while data=myTable works.

    #+begin_src gnuplot :var data=myTable :exports code :file basic-plot.png
    set xdata time
    set timefmt "%Y-%m-%d"
    plot data u 1:2 with linespoints

What did I miss here https://orgmode.org/worg/org-contrib/babel/intro.html#results in order to refer to RESULTS?

2 Answers 2

1

Your results block needs a name, which you supply either by naming the source block that generates it:

#+NAME: goodResult
#+begin_src bash 
echo "2057-01-01 10 
2057-01-02  7 
2057-01-03  3 
2057-01-04  2 "
#+end_src

OR by adding a #+NAME: keyword as the first line of the #+RESULTS: block

#+NAME: resultName
#+RESULTS:
| 2057-01-01 | 15 |
| 2057-01-02 |  5 |
| 2057-01-03 |  3 |
| 2057-01-04 |  2 |

In the first case, references to goodResult will tell babel to compute the source block, and use the results in the current code block. In the second case, the named results block resultName will be used directly in the current code block.

0

It looks to me like the Worg page you reference could perhaps be clearer about what it's telling you, which is that results: is an optional header argument for a #+begin_src block. This means that results: is not an in-buffer setting like #+tblname, which is how you are trying to use it here.

To be fair, the Worg page is all about #+begin_src blocks. Nevertheless, the examples for results: are not given in their full proper context. Perhaps they should be.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.