Go to the first, previous, next, last section, table of contents.


Printing graph using gnuplot as auxiliary tool.

Author(s): David Trallero Mena.

This library uses gnuplot for printing graphs.

Two predicates are provided:

  • genarate_plot( BaseName , DataList )
  • genarate_plot( BaseName , DataList , GlobalOptions ) Several files can be generated as temporary files. A BaseName is requiered for generating the tempoaries files.Data files name will be created from BaseName + number + .dat. The BaseName + ".plot" will be the name used for gnuplot tool. A list of pairs of list of pairs of the from (X,Y) and Local Option value is provided to the main predicate as data. In other words DataList = [(CurveDataList,LocalOptions), (CurveDataList1,LocalOptions1) ...]. Additionaly (function( String ) , LocalOptions) can be used for adding a curve to the plot (imagine you want to compare your result with x=y). LocalOptions of the DataList are options that are applied to the curve, as for example, if we print the curve with lines, or the title in the leyend, etc. GlobalOptions are referred to the plot options, like title in x or y axis, etc.

    Usage and interface (gnuplot)

    Documentation on exports (gnuplot)

    PREDICATE: get_general_options/1:

    Usage: get_general_options(X)

    • Description: Get the general options of the graphic that will be plotted
    • The following properties should hold at call time: X is a free variable. (term_typing:var/1)
    • The following properties should hold upon exit: X is a list. (basic_props:list/1)

    PREDICATE: set_general_options/1:

    Usage: set_general_options(list(X))

    • Description: Get the general options of the graphic that will be plotted. Posible options are:
    • format(A) Specify the format of points
    • nokey Leyend is no represented
    • nogrid No grid
    • grid An smooth grid is shown
    • label(L , (X,Y)) Put Label L at point (X,Y)
    • xlabel(A) Label of X-Axis
    • ylabel(A) Lavel of Y-Axis
    • xrange(A,B) Define the X range representation
    • yrange(A,B) Define the Y range representation
    • title(A) Title of the plot
    • key(A) define the key (for example [left,box], left is the position, box indicates that a box should be around)
    • term_post(A) define the postcript terminal. A is a list of atoms.
    • size(A,B) specify the size of the plot (A,B float numbers)
    • autoscale autoscale the size of the plot
    • autoscale(A) autoscale the argument (for example: autoscale(x))

    PREDICATE: generate_plot/2:

    Usage: generate_plot(BaseName, TimeList)

    • Description: This predicates generate a 'BaseName + .ps' postcript file using each element of TimeList as pair of list of pairs and local options, i.e., ( list((X,Y)), LocalOptions), in which X is the position in X-Axis and Y is the position in Y-Axis. Nevertheless, each element of TimeList can be a list of pairs instead of a pair for comodity. gnuplot is used as ausiliary tool. Temporary files 'BaseName + N.dat' are generated for for every list of pairs, and 'BaseName + .plot' is de file used by gnuplot. The local options can be:
    • with(Option) Tells how the curve will be represented. Option can b line, dots, boxes, impulses, linespoints. This option HAVE TO BE the last one
    • title(T) Put the name of the curve in the leyend to T
    • The following properties should hold at call time: BaseName is currently instantiated to an atom. (term_typing:atom/1) TimeList is a list of pairs. (basic_props:list/2)
    • The following properties should hold upon exit: BaseName is currently instantiated to an atom. (term_typing:atom/1) TimeList is a list of pairs. (basic_props:list/2)

    PREDICATE: generate_plot/3:

    Usage: generate_plot(BaseName, TimeList, GeneralOptions)

    • Description: It is the same as generate_plot/2 but GeneralOptions are used as the general options of the plot. Look at predicate set_general_options for detailed description of posible options
    • The following properties should hold at call time: BaseName is currently instantiated to an atom. (term_typing:atom/1) TimeList is a list of pairs. (basic_props:list/2) GeneralOptions is a list. (basic_props:list/1)
    • The following properties should hold upon exit: BaseName is currently instantiated to an atom. (term_typing:atom/1) TimeList is a list of pairs. (basic_props:list/2) GeneralOptions is a list. (basic_props:list/1)


    Go to the first, previous, next, last section, table of contents.