help-octave
[Top][All Lists]
Advanced

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

gnuplot 3.6beta


From: John W. Eaton
Subject: gnuplot 3.6beta
Date: Fri, 9 May 1997 11:13:31 -0500

On  9-May-1997, Nils Naumann <address@hidden> wrote:

| how can I access the new features of gnuplot 3.6beta from within
| octave?  The gplot command seems not to accept the new keywords `axes'
| and `smooth'.  Only multiplot is supported. If I need a 2'nd y scale,
| I have to save the data into a file and drawing the diagrams directly
| with gnuplot.

The new keywords won't with Octave's gplot command until someone fixes
Octave to also understand them.

The problem is that Octave parses the gplot command so that things
like

  foo = rand (51, 1);
  lo = -5;
  hi = 55;
  line_type = 4;
  gplot [lo:hi] foo with lines line_type

will work without having to use various combinations of eval(),
sprintf(), etc.  For example, if Octave did not parse the command to
evaluate the appropriate expressions, but just sent gplot's arguments
to gnuplot through a pipe, you would have to write something like

  file = tmpnam ();
  eval (sprintf ("save -ascii %s foo", file));
  eval (sprintf ("gplot [%d:%d] %s with lines %d", lo, hi, file, line_type);

which seems rather inconvenient.  Also, it would leave a junk file in
/tmp unless you arranged to clean it up yourself.

If you are willing to do the extra work, you can use whatever gnuplot
features you like.  For example:

  plot_stream = popen ("gnuplot", "w");
  foo = rand (51, 2);
  lo = -5;
  hi = 55;
  file = tmpnam ();
  eval (sprintf ("save -ascii %s foo", file));
  fprintf (plot_stream, "set y2tics\n");
  fprintf (plot_stream,
           sprintf ("plot [%d:%d] '%s' u 1 axes x1y1, '%s' u 2 axes x1y2\n",
                    lo, hi, file, file));
  fflush (plot_stream);

It would be nice if Octave could automatically use whatever features
are availble in gnuplot, but I don't see a way to make that happen.
If anyone else does have a reasonable solution to the problem, send
me mail (working code would also be helpful!).

Thanks,

jwe


reply via email to

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