[ Reference Manual | Alphabetic Index ]

library(gnuplot)

Interface to the function and data plotting program - gnuplot   [more]

Predicates

plot(++Data)
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.

Description

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!.

Examples

:-lib(gnuplot).

sample:-
        % 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,
                                          with:linespoints,
                                          pointsize:3]),

        % multiple y values in nested lists with lines, boxes and titles
        C=[[1,2,4,9,18,27,3],[1,4,16,36,25,16,9]],
        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
        D=[]([](1,2,4,6,7,8,9),[](1,4,16,36,49,64,81)),
           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),
         foreach(R-X,SinPoints),
         foreach(R-Y,CosPoints),
         foreach(R-Z,TanPoints)
        do
            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]).
        

About


Generated from gnuplot.eci on 2022-09-03 14:26