emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Producing figures from octave
@ 2011-08-31 21:36 Ethan Ligon
  2011-09-01  3:47 ` Dan Davison
  0 siblings, 1 reply; 2+ messages in thread
From: Ethan Ligon @ 2011-08-31 21:36 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org; +Cc: davison

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

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

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

#+results:
[[file:chart.png]]

The figure seems to be (briefly) created (it pops up on my screen if I
change 'figure( 1, "visible", "off" );' to 'figure( 1, "visible",
"on");'; also the code provided does the right thing in the octave interpreter).

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
-- 
Ethan Ligon, Associate Professor
Agricultural & Resource Economics
University of California, Berkeley

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [babel] Producing figures from octave
  2011-08-31 21:36 [babel] Producing figures from octave Ethan Ligon
@ 2011-09-01  3:47 ` Dan Davison
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Davison @ 2011-09-01  3:47 UTC (permalink / raw)
  To: emacs-orgmode

Ethan Ligon <ligon@are.berkeley.edu> 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" );
sombrero;
print -dpng chart.png;
ans = "chart.png";
#+end_src

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

I've updated the worg page.

Dan

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-01  3:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-31 21:36 [babel] Producing figures from octave Ethan Ligon
2011-09-01  3:47 ` Dan Davison

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).