Plotting...

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plotting...

Ian Searle-2

        Hello all, I subscribe to the octave list primarily for the
        education, I am not an Octave user :-) I have been following
        some discussion about I/O and graphics. I think I could
        contribute some information, since I have some experience.

        Note that this is by _no_ means an attempt to convert Octave
        users. Nor is this an attempt to start a flame-war or a
        feature-debate. This is merely information. I hope you will get
        something from it.

        When I first started rlab, I decided to try and do away with
        the classic file handles. You write to a file, by identifying
        it with a string. Additionally, you can write/read to/from a
        pipe by making `|' the first character of the string. Thus:

        fprintf ("|gnuplot", "plot %s using 1:3\n", data_file);

        works quite nicely. For quite a long time gnuplot was the only
        plotting capability in rlab. All of the plotting capability
        was implemented in script files. In fact, rlab is still
        distributed with a set of files to allow plotting via
        gnuplot. A nice thing about doing the plot interface this way
        is that it is not too difficult to maintain/extend. In fact,
        after I switched rlab to Plplot, a user who likes gnuplot
        better, upgraded and extended the gnuplot interface completely
        on his own.

        There are some disadvantages to using gnuplot, which
        ultimately caused me to switch to Plplot. (1) gnuplot plotting
        must be done with temporary files, since gnuplot cannot read
        data from stdin. (2) gnuplot lacks some important features,
        primarily multiple plots per page, and (3) interactive
        plotting with gnuplot requires the OS be multi-tasking (this
        rules out DOS/Mac). Note that Plplot is not perfect either, I
        will get around to criticizing it later :-) But, on the whole
        Plplot is an excellent package. Furthermore, the
        developers/maintainers are good people.

        At present rlab uses Plplot for interactive graphics. The
        Plplot library is linked into rlab during the build (unless
        the user does --with-gnuplot, or the Plplot library is not
        found). I am fairly happy with the implementation. Basically,
        I mimicked the Plplot API with builtin rlab functions. These
        functions are all nicely segregated into a single .c and .h
        file. Some #ifdefs take care of the rest of the
        segregation. The builtin low-level plotting functions are
        "hidden"; in rlab variables that begin with the `_' character
        are not "visible" (but they are usable). The high level
        plotting functions, like plot(), and plmesh(), are written in
        script.

        There are several benefits to this method: (1) The high level
        plot functions were much easier to write (as opposed to doing
        them in C), and (2) the plotting functions are more
        "adaptable". If Plplot were to undergo big changes, or someone
        wanted to use another plot library, the effort is minimal (not
        zero). Additionally, users can implement new high level
        plotting functions on their own, without writing builtin
        functions.

        Plplot offers some advantages over gnuplot:

                (1) It does not require a multi-tasking OS to
                use. Thus the DOS and Mac ports of rlab have
                interactive plotting quite similar to the Unix
                version.

                Plotting does not require temporary files with
                Plplot.

                (2) Plplot offers multiple plots per page.

                (3) Plplot offers a nice, Tcl/TK graphics window for
                Unix workstations. Printing, zooming, and
                color-pallete modifying.

        The only disadvantage (IMHO) to using Plplot is the lack of
        Postscript fonts in the hardcopy.

        I hope this information/experience is useful to someone...

        -Ian Searle

Reply | Threaded
Open this post in threaded view
|

Re: Plotting...

Vinayak Dutt
Ian Searle writes:
#
# There are some disadvantages to using gnuplot, which
# ultimately caused me to switch to Plplot. (1) gnuplot plotting
# must be done with temporary files, since gnuplot cannot read
# data from stdin. (2) gnuplot lacks some important features,
# primarily multiple plots per page, and (3) interactive
# plotting with gnuplot requires the OS be multi-tasking (this
# rules out DOS/Mac). Note that Plplot is not perfect either, I
# will get around to criticizing it later :-) But, on the whole
# Plplot is an excellent package. Furthermore, the
# developers/maintainers are good people.
#
  I guess one could argue about multi-tasking is good thing or not. For one it helps
in one sense that one could create multiple tools geared for differing tasks and let
each tool do things which its good at rather than build one huge monolithic tool. I think
thats the basic Unix philosophy. Having graphics tool separate from Octave helps in
maintaining Octave also as one does not have to recompile Octave every time there
are fixes to gnuplot. The two tools could be improved independently. Also one is not
just limited to gnuplot, any tool which does the job could be used. All graphics tools
have pluses and minuses, and so it would be certainly beneficial to have ability to
pick the graphics tool according to the requirments.

--vinayak-
/*
 * vinayak dutt
 * graduate student, ultrasound research
 * mayo graduate school, rochester mn
 *
 * e-mail: [hidden email]
 *         [hidden email]
 *
 */
#include "disclaimer.h"

Reply | Threaded
Open this post in threaded view
|

Re: Plotting...

John Eaton-4
In reply to this post by Ian Searle-2
Tony Roberts <[hidden email]> wrote:

: I generally support this principle.  For example, I like using xgraph
: to prepare 2D plots (so I wrote a plotting function xgraph.m to prepare
: a datafile and then pass it to xgraph).  On my travels I have found it
: easier to take xgraph around "with" me, rather than to hassle system
: administrators to install gnuplot properly.

This will certainly still be possible.  I'm not planning to remove
support for gnuplot, just provide some other/better alternative(s).

Would you like to contribute your xgraph M-files?

Thanks,

jwe

Reply | Threaded
Open this post in threaded view
|

Re: Plotting...

Vinayak Dutt
John Eaton wrote:
#
#This will certainly still be possible.  I'm not planning to remove
#support for gnuplot, just provide some other/better alternative(s).
#

Actually, once you have the pipe support, you could make gnuplot
supported entirely with scripts.

#Would you like to contribute your xgraph M-files?
#

By the way, i have some support .m files for the multiplot patched
gnuplot.  The mulitplot patch allows plotting multiple plots on the
same plotting area. The patch isn't all the perfect ( like the multiple
plots are not visible after the plot command, but you have to toggle
out of multiplot mode to see the multiple plots etc ), but its useful.


--vinayak-
/*
 * vinayak dutt
 * graduate student, ultrasound research
 * mayo graduate school, rochester mn
 *
 * e-mail: [hidden email]
 *         [hidden email]
 *
 */
#include "disclaimer.h"

Reply | Threaded
Open this post in threaded view
|

Re: Plotting...

Tony Roberts-4
In reply to this post by Ian Searle-2

> are fixes to gnuplot. The two tools could be improved independently. Also one is not
> just limited to gnuplot, any tool which does the job could be used. All graphics tools
> have pluses and minuses, and so it would be certainly beneficial to have ability to
> pick the graphics tool according to the requirments.
>

I generally support this principle.  For example, I like using xgraph
to prepare 2D plots (so I wrote a plotting function xgraph.m to prepare
a datafile and then pass it to xgraph).  On my travels I have found it
easier to take xgraph around "with" me, rather than to hassle system
administrators to install gnuplot properly.
                                        Tony
-------------------------------------------------------------------------------
  Professor A.J. Roberts
  Dept of Mathematics & Computing      E-mail: [hidden email]
  University of Southern Queensland    Phone:  (076) 312943
  Toowoomba, Queensland 4350           Fax:    (076) 312721
  AUSTRALIA                            WWW:    ftp://ftp.usq.edu.au/pub/aroberts
-------------------------------------------------------------------------------