[ Reference Manual | Alphabetic Index ]


Interface to the function and data plotting program - gnuplot


Plot the given data using default options
plot(++Data, +Options)
Plots the given data using the given options
plot(++Data, +Options, +OutputFile)
Plots the given data to a file.
plot(++Data, +Options, +Format, +OutputFile)
Plots the given data to a file in the given format.


This library provides an interface to the function and data plotting program - gnuplot.

The gnuplot program is available for most platforms and can be downloaded from http://www.gnuplot.info/. This version of lib(gnuplot) officially supports gnuplot version 3.7 and higher though it may work with earlier versions as well.

The executable gnuplot on Unices, and pgnuplot.exe on Windows must be installed on the default path, or be present in the current working directory. NOTE: On Windows it is NOT sufficient to simply have the gnuplot.exe or wgnuplot.exe, you must have the pgnuplot.exe as well.

See the various plot predicates for further example usage.

For a complete description of the avilable options we refer the user to the excellent documentation which accompanies gnuplot. Most features have an obvious analogue in this library.

Syntax note: wherever gnuplot expects a string as an option value, use a double-quoted ECLiPSe string - unquoted or single-quoted atoms will not work!.



        % x-y pairs with 'points'
        A=[1-3,5-2,9-2,8-2,5-7], plot(A, [with:points]),

        % y values with large 'smooth' lines and points
        B=[1,2,3,4,8,9,4,2,4,6], plot(B, [smooth: csplines,

        % multiple y values in nested lists with lines, boxes and titles
        plot(C, [with:[lines, boxes], title:['data 1', 'data 2']]),

        % multiple y values in an array, in a certain range, with impulses of
        % different widths
           plot(D, [ranges:(3:6), with:impulses, linewidth:[8,2]]),

        % multiple t-r pairs, in polar coordinates with a grid and lines
        E=[[1-3,5-2,9-2,8-2,5-7], [1-2,5-4,8-6,9-1,12-4]],
           plot(E,[set:[polar, grid=polar], with:lines]),

        % compute sin and cos and tan points
        (for(I, 0, 314),
            R is I / 100,
            X is sin(R),
            Y is cos(R),
            Z is tan(R)
        % plot sin and cos on a polar plot
        plot([SinPoints, CosPoints],
             [set:[polar, grid=polar], with:linespoints,
              title:["sin", "cos"]]),

        % plot sin, cos and tan on a logarithmic polar plot
        plot([SinPoints, CosPoints, TanPoints],
             [set:[polar, grid=polar,logscale=xy], with:linespoints,
              title:["sin", "cos", "tan"]]),
        % a(x,y,error) = x-y data with error values for the y values
        F=[a(1,1,0.1),a(2,2,0.1),a(5,3,0.5),a(6,2,0.5), a(7,3,0.5)],
        plot(F, [ranges:[ 0:8, 0:6], with:boxes]),
        plot(F, [ranges:[ 0:8, 0:6], with:errorbars]),
        plot(F, [ranges:[ 0:8, 0:6], with:boxerrorbars]),
        % a(x,y,error) = x-y data with error values for the y values
        % and a gap between x=2 and x=5
        G=[a(1,1,0.1),a(2,2,0.1),-,a(5,3,0.5),a(6,2,0.5), a(7,3,0.5)],
        plot(G, [ranges:[ 0:8, 0:6], with:boxes]),
        plot(G, [ranges:[ 0:8, 0:6], with:errorbars]),
        plot(G, [ranges:[ 0:8, 0:6], with:boxerrorbars]).


Generated from gnuplot.eci on 2017-07-09 15:37