help-octave
[Top][All Lists]
Advanced

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

Re: gnuplot functionallity in octave


From: Torsten Lange
Subject: Re: gnuplot functionallity in octave
Date: Mon, 22 Mar 2010 15:05:31 +0100
User-agent: KMail/1.10.3 (Linux/2.6.27.45-0.1-default; KDE/4.1.3; x86_64; ; )

Am Montag, 22. März 2010 12:27:37 schrieb Olaf Till:
> On Fri, Mar 19, 2010 at 12:27:52PM +0100, address@hidden wrote:
> > Hello,
> >
> > I just gave a colleague of mine a printed German Gnuplot tutorial
> > (prepared by the computer center of Hannover, Germany). Actually he is
> > working with a variety of lab devices. So he's dealing with many kinds of
> > ascii data and has to create publication-ready plots.
> >
> > I suggested him to use Octave because it might be more comfortable when
> > it comes to data manipulation or some calculations. Although he was very
> > interested, he was unsure about my suggestion since his English is not
> > that good.
> >
> > My question: Since until now I have not created plots for publishing
> > through Octave is it in general possible to access all the functionallity
> > of gnuplot via Octave? And, will the German Gnuplot manual still be
> > helpfull for him?
>
> I do not know if current Octave versions allow to control all Gnuplot
> features with high level commands. But there were not all features
> controllable previously, e.g. font size of tick-labels, if I remember
> right. Some, including myself, use(d) to send Gnuplot commands
> directly to Gnuplot from Octave to obtain publication-quality figures
> of plots, similar to that, e.g.:
>
>
> ofile = "figure.eps";
> scale = .75;
> settings = ["unset key\n", \
>             "set xlabel 'independent variable [unit]'\n", \
>             "set ylabel 'dependent variable'\n", \
>             "set xrange [0:]\n", \
>             sprintf ("setsize %f,%f\n", scale, scale)];
> fmt = "with lines linetype 1 linewidth 3";
>
> gnupl_fid = popen ("gnuplot - &> /dev/null", "w");
> fprintf (gnupl_fid, settings);
> fprintf (gnupl_fid, "set terminal postscript eps enhanced monochrome
> 22\n"); fprintf (gnupl_fid, sprintf ("set output '%s'\n", ofile));
>
> n = ...; # number of traces in the plot
>
> fprintf (gnupl_fid, sprintf ("plot '-' %s%s\n", fmt, \
>                            repmat \
>                            (sprintf (", '-' %s", fmt), 1, n - 1)));
>
> for id = 1:n
>
>   data = ...; # prepare your data, x in row 1, y in row 2
>   fprintf (gnupl_fid, "%.16f %.16f\n", data);
>   fprintf (gnupl_fid, "e\n");
>
> endfor
>
> fprintf (gnupl_fid, "exit\n");
> pclose (gnupl_fid);
>
>
> Note also that Etienne Grossmann has written Octave functions which
> facilitate such a communication with Gnuplot. They are available at
> his homepage.
>
> So, with the above approach, the German Gnuplot manual _will_ be
> useful for your colleague ...
>
> Olaf


Olaf, thanks for this insight! Yes, I'm afraid working through pipes etc. 
would probably be very cumbersome and confusing for him at this stage. 
However, the details provided me some hints on how to eventually include this 
stuff into my scripts once it is needed. I was not sure about the level of 
connection between octave and gnuplot.

Torsten






reply via email to

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