[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] Producing figures from octave

From: Dan Davison
Subject: Re: [O] [babel] Producing figures from octave
Date: Wed, 31 Aug 2011 20:47:04 -0700
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (darwin)

Ethan Ligon <address@hidden> writes:

> Dan Davison has a brief worg tutorial on using babel with octave at
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-octave-matlab.html
Hi Ethan,

> Amongst other things, he offers the following example block for
> producing a figure:

(Actually, the example is not by me.)

> #+begin_src octave :output file :file chart.png
> figure( 1, "visible", "off" );
> sombrero;
> print -dpng chart.png
> #+end_src

:output file is wrong (there's no header arg named :output).
:file chart.png says to write the results to that file. The "results"
are whatvever the variable `ans` holds at the end of the block, and I
think that must be the file path you're seeing.

One way to write that example is:

#+begin_src octave :results file
figure( 1, "visible", "off" );
print -dpng chart.png;
ans = "chart.png";

:results file says to interpret the result as a file path.

I've updated the worg page.


> However, rather than delivering the png figure, the file chart.png
> consists solely of the string "/usr/share/octave/packages/3.2".  I'm
> not sure where this string is coming from:
> it's *not* part of the
> stuff that octave writes to stdout when the interpreter is invoked (my
> first guess).
> I suspect that the options that need to be offered on the #+begin_src
> line have changed somehow since that worg page was last updated at the
> end of April of this year, but don't really know.
> Help!
> -Ethan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]