help-octave
[Top][All Lists]
Advanced

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

Re: Lining up the axes of multiplots/subplots


From: John W. Eaton
Subject: Re: Lining up the axes of multiplots/subplots
Date: Mon, 20 Nov 2006 11:45:54 -0500

On 20-Nov-2006, Michael Kopp wrote:

| What I sometimes do as a workaround is to have my octave script write and
| execute the gnuplot script, like
| 
| plotfile = 'plot.gpl'
| f1 = fopen(plotfile, 'w')
| fprintf('plot \"data.txt u 1:2 w lines\"'); % or something more complicated
| fclose(f1);
| system(sprintf('gnuplot %s', plotfile));
| unlink(plotfile);
| 
| When plotting large datasets, this is also considerably faster than using
| the octave plot command.
| 
| The above works on Linux. I don't know about Windows or Mac.

It would work there too.  You could also write something like

  x = (-10:0.1:10)';
  data = [x, sin(x)];
  gp = popen ("gnuplot", "w");
  fprintf (gp, "set term x11\n");
  fprintf (gp, "plot '-' u 1:2 w l\n");
  fprintf (gp, "%.4g %.4g\n", data');
  fprintf (gp, "e\n");
  fflush (gp);
  ...
  pclose (gp);  

and avoid having to put your data in a file.

See

 http://www.cae.wisc.edu/pipermail/octave-maintainers/2006-November/001301.html

for some examples of the sort of thing that will be possible in a
future version of Octave, which will make doing things like this
somewhat easier.

jwe


reply via email to

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