[O] Org-babel results preamble
I have found that using org-plot to plot the results output of an org-babel code block is very useful in prototyping my code. One minor annoyance is the need to remove and replace the #+PLOT: header at the beginning of the results output. Is it possible to specify a "preamble" in the source block? I am looking to produce something like this: #+begin_src sh :results wrap ./dtest #+end_src #+PLOT: ind:1 deps:(2) #+results: #+BEGIN_RESULT | 0.000E+000 | 1.0 | | 9.99776482582E-003 | 0.99000223517 | | 1.99955296516E-002 | 0.98000447035 | | 2.99932944775E-002 | 0.97000670552 | | 3.99910593033E-002 |0.9600089407 | | 4.99888241291E-002 | 0.95001117587 | #+END_RESULT Thanks, Derek
Re: [O] Org-babel results preamble
Hi Derek, If you name your code block, then it should be possible to update results without any need to replace the lines preceding the results. For example, #+source: disk-usage #+begin_src sh df #+end_src #+PLOT: title:"Disk Usage" ind:6 deps:(5) type:2d with:histograms set:"yrange [0:100]" #+results: disk-usage | Filesystem | 1K-blocks | Used | Available | Use% | Mounted | on | | /dev/sda6 | 28835836 | 8447712 | 18923344 | 31% | / || | none | 2997072 | 676 | 2996396 | 1% | /dev || | none | 3006056 |0 | 3006056 | 0% | /dev/shm || | none | 3006056 | 96 | 3005960 | 1% | /var/run || | none | 3006056 |0 | 3006056 | 0% | /var/lock || | /dev/sda7 | 144176824 | 72225604 | 64627420 | 53% | /home || Derek Thomas writes: > I have found that using org-plot to plot the results output of an > org-babel code block is very useful in prototyping my code. One minor > annoyance is the need to remove and replace the #+PLOT: header at the > beginning of the results output. Is it possible to specify a > "preamble" in the source block? I am looking to produce something > like this: > > #+begin_src sh :results wrap > ./dtest > #+end_src > #+PLOT: ind:1 deps:(2) > #+results: > #+BEGIN_RESULT > | 0.000E+000 | 1.0 | > | 9.99776482582E-003 | 0.99000223517 | > | 1.99955296516E-002 | 0.98000447035 | > | 2.99932944775E-002 | 0.97000670552 | > | 3.99910593033E-002 |0.9600089407 | > | 4.99888241291E-002 | 0.95001117587 | > #+END_RESULT > Thanks, > > Derek > -- Eric Schulte http://cs.unm.edu/~eschulte/
Re: [O] Org-babel results preamble
Derek Thomas writes: > I have found that using org-plot to plot the results output of an > org-babel code block is very useful in prototyping my code. One minor > annoyance is the need to remove and replace the #+PLOT: header at the > beginning of the results output. Is it possible to specify a > "preamble" in the source block? I am looking to produce something > like this: > > #+begin_src sh :results wrap > ./dtest > #+end_src > #+PLOT: ind:1 deps:(2) > #+results: > #+BEGIN_RESULT > | 0.000E+000 | 1.0 | > | 9.99776482582E-003 | 0.99000223517 | > | 1.99955296516E-002 | 0.98000447035 | > | 2.99932944775E-002 | 0.97000670552 | > | 3.99910593033E-002 |0.9600089407 | > | 4.99888241291E-002 | 0.95001117587 | > #+END_RESULT > Thanks, > > Derek I am slowly going through all the org emails that I have received in the three weeks I was off. This was one of them and appears to not have been answered? In any case, possibly naming the src block may achieve what you want because then the results are placed in the same place every time regardless of where the results block is... not tested, especially in the context of plotting mind you. HTH, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.7 (release_7.7.175.g8478)
Re: [O] Org-babel results preamble
On Thu, Aug 25, 2011 at 9:50 AM, Eric S Fraga wrote: > I am slowly going through all the org emails that I have received in the > three weeks I was off. This was one of them and appears to not have > been answered? > > In any case, possibly naming the src block may achieve what you want > because then the results are placed in the same place every time > regardless of where the results block is... not tested, especially in > the context of plotting mind you. Thanks for the response, naming the src block has been working great so far. Derek