emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: emacs-orgmode@gnu.org
Subject: [babel] how to pass data to gnuplot from another block
Date: Fri, 22 Nov 2013 09:57:20 +0000	[thread overview]
Message-ID: <87d2lsbvy7.fsf@ucl.ac.uk> (raw)

Hello,

everything I have seen on the list and on Worg seems to indicate that it
should be possible to pass data from a babel src block to a gnuplot src
block.  See, for instance, the excellent article on data collection and
analysis at

http://orgmode.org/worg/org-contrib/babel/examples/data-collection-analysis.html

I don't have R so I have not tried the examples on this page.  However,
I have tried the following using octave and gnuplot:

#+begin_src org
  ,#+TITLE:     examplebug.org
  ,#+AUTHOR:    Eric S Fraga
  ,* bubble and dew points
  ,#+name: bubble-point-temperatures
  ,#+begin_src octave :results raw output
    A = [   6.86880    6.84941]';
    B = [1154.646   1206.001]';
    C = [ 226.046    223.148]';
    pv = @(T) 10.^(A-B./(T+C));
    x = 0;
    res = [];
    while x<(1+1e-3)
      f = @(T) 760 - [x (1-x)]*pv(T);
      T = fsolve(f, 70);
      printf("| %5.2f | %7.2f | \n", x, T);
      res = [res; [x T] ];
      x = x + 0.05;
    endwhile
  ,#+end_src
  
  ,#+begin_src gnuplot :var data=bubble-point-temperatures :file "bubble.pdf"
    set terminal pdfcairo mono enhanced font ",12" size 10cm,6cm
    plot data
  ,#+end_src
  
  ,#+results:
  [[file:bubble.pdf]]
#+end_src
  
Trying to execute the gnuplot block leads to an error in gnuplot because
the output of the octave data block is being put directly into the data
variable instead of into a file whose name is passed to the data
variable.  The latter happens if the source of the data is a table
instead of a src block.

I have tried various combinations of output directives for the first src
block but to no avail.

I have tried this with "emacs -Q", by the way, and my org is up to date
as of a few minutes ago!

What am I doing wrong please?

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.2.3c-266-g7a726d

             reply	other threads:[~2013-11-22  9:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22  9:57 Eric S Fraga [this message]
2013-11-22 15:00 ` [babel] how to pass data to gnuplot from another block Eric Schulte
2013-11-22 17:27   ` Nick Dokos
2013-11-23 16:15     ` Eric Schulte
2013-12-13 15:23       ` Greg Troxel
2013-12-13 15:30         ` Eric Schulte
2013-12-13 15:48           ` Greg Troxel
2013-12-13 16:20             ` Eric Schulte
2013-12-13 17:13               ` Eric Schulte
2013-12-13 19:32                 ` Nick Dokos
2013-12-13 22:40                 ` Achim Gratz
2013-12-13 23:18                 ` Eric Schulte
2013-12-14 10:21                   ` Achim Gratz
2013-12-13 18:38               ` Greg Troxel
2013-12-13 19:08                 ` Sebastien Vauban
2013-12-13 16:32           ` Achim Gratz
2013-12-05  7:35   ` Eric S Fraga
2013-12-05 18:29     ` Eric Schulte
2013-12-05 19:59       ` Eric S Fraga
2013-12-06  2:06         ` Eric Schulte
2013-12-06 11:59           ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2lsbvy7.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).