help-octave
[Top][All Lists]
Advanced

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

Re: Saving Octave Plots


From: Gerald Ebberink
Subject: Re: Saving Octave Plots
Date: Wed, 16 Mar 2005 09:46:39 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> I use LaTeX for documentation.  I've found that a nice way to include
> figures is to take the following steps:
> 
>   (1) Use Octave to generate data.  Save data as an ASCII text file.
>       The x-axis is the first column.  The first line to plot is the
>       second column; the second line to plot is the third column; etc.
> 
>   (2) Use Gnuplot to plot the data and output the figure in LaTeX code.
>       Like with Octave, you can write a script to interact with Gnuplot.
>       The first line of the script sets the output to pslates:
> 
>         set term pslatex monochrome dashed rotate 8
> 
>       The output is defined as
> 
>         set output "plot.tex"
> 
>       The plotting command might be
> 
>         plot [0:30][0:2.5] "~/work/2005/datafile"\
>           every 2 title 'Line 1' with lines ls 1
> 
>       where the linestyle (ls) defined as
>       
>         set style line 1 lt 2 lw 1
> 
>       etc.
> 
>   (3) The LaTeX code in included into the LaTeX source file:
> 
>         \input{plot.tex}

Specialy for this I have created the attached m-file (which actualy is a
adaptation of a other m-file I saw in the list earlier). This m-file
also happens to make a pdf for the people who use pdfLaTeX and can't use
the eps for that.

- --
Ing. Gerald Ebberink
Research Technician

Kernfysisch Versneller Instituut
Rijksuniversiteit Groningen
Zernikelaan 25
9747 AA Groningen
The Netherlands
tel: +31 50 363 3518
lab: +31 50 363 3588
mob: +31 62 460 9930
fax: +31 50 363 4003
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCN/JvbSbfYz8yWIMRAvZ9AJ42fskLisGbMhnvKSnNk5z8QPvUygCgnWeN
YLXkdAij/OGmEqIOOWLfml0=
=oyV5
-----END PGP SIGNATURE-----
##
## (void) latexplot("file.ext")
##
function latexplot (filename)

  ## figure out gnuplot terminal type, based on extension
  termtype.fig = "fig color big thickness 2 fontsize 20";
  termtype.eps = "postscript eps color \"Helvetica\" 20";
  termtype.mp = "mp color";

  eval(sprintf("gset output \"%s\";", filename));
  eval(sprintf("gset term epslatex color;"));
  replot;

  ## reset default plotting values
  gset term x11;
  gset output;
  
  eval(sprintf("system (\"epstopdf %s\");", filename));
endfunction

Attachment: ebberink.vcf
Description: Vcard


reply via email to

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