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


Depic line graph

Author(s): Isabel Martín.

Version: 1.10#7 (2006/4/26, 19:22:13 CEST)

Version of last change: 1.9#269 (2004/1/1, 14:17:43 CET)

This module defines predicates which depict line graph and scatter graph widgets. All eigth predicates exported by this module plot two-variable data. Each point is defined by its X-Y coordinate values. A dataset is defined by two lists xvector and yvector, which contain the points coordinates. As you might guess, the values placed in the the same position in both lists are the coordinates of a point. They both share the following features:

The names of the line graph predicates begin with graph_ and those corresponding to the scatter graph group begin with scattergraph_.

Usage and interface (gengraph1)

Documentation on exports (gengraph1)

PREDICATE: graph_b1/9:

graph_b1(Header, GTitle, XTitle, XVector, YTitle, YVectors, LAtts, Footer, Smooth)

Besides the features mentioned at the begining of the chapter, the displayed graph generated when calling this predicate has the following distinguishing characteristics:

Example:

graph_b1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  'yaxixtitle',
  [ [10,35,40],[25,50,60] ],
  [ ['element1','Blue','Yellow','plus',6],['element2',Outline,Color] ],
  'footer',
  'linear').

PREDICATE: graph_b1/13:

graph_b1(Header, GT, XT, XV, XMax, XMin, YT, YVs, YMax, YMin, LAtts, Footer, Smooth)

The particular features related to this predicate are described below:

Example:

graph_b1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  50,
  _,
  'yaxixtitle',
  [[10,35,40],[25,50,60]],
  50,
  _,
  [['line1','circle',4],['line2',OutlineColor,Color]],
  'footer',
  'step').

PREDICATE: graph_w1/9:

graph_w1(Header, GTitle, XTitle, XVector, YTitle, YVectors, LAtts, Footer, Smooth)

This predicate is quite similar to graph_b1/9. The differences lies in the plot background color and in the cross hairs color, which are white and black respectively.

Example:

graph_w1('This is the header text', 
  'Graph_title', 
  'xaxistitle',
  [20,10,40,50], 
  'yaxixtitle', 
  [ [10,35,40,50],[25,20,60,40] ],
  [['line1','Blue','DarkOrchid'],['line2','circle',3]],
  'footer', 
  'quadratic').  

PREDICATE: graph_w1/13:

graph_w1(Header, GT, XT, XV, XMax, XMin, YT, YVs, YMax, YMin, LAtts, Footer, Smooth)

This predicate is quite similar to graph_b1/13, the differences between them are listed below:

Example:

graph_w1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  100,
  10,      
  'yaxixtitle',
  [[10,35,40],[25,20,60]],
  _,
  _,
  [['element1','Blue','Yellow'],['element2','Turquoise','Plum']],
  'footer',
  'quadratic').

PREDICATE: scattergraph_b1/8:

scattergraph_b1(Header, GTitle, XTitle, XVector, YTitle, YVectors, PAtts, Footer)

Apart from the features brought up at the beginning of the chapter, the scatter graph displayed invoking this predicate has the following characteristics:

Example:

scattergraph_b1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [10,15,20],
  'yaxixtitle',
  [[10,35,20],[15,11,21]],
  [['element1','Blue','Yellow'],['element2','Turquoise','Plum']],
  'footer').

PREDICATE: scattergraph_b1/12:

scattergraph_b1(Header, GT, XT, XV, XMax, XMin, YT, YVs, YMax, YMin, PAtts, Footer)

The particular features related to this predicate are described below:

Example:

scattergraph_b1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  50,
  _,
  'yaxixtitle',
  [[10,35,40],[25,50,60]],
  50,
  _,
  [['point dataset1','Blue','Yellow'],['point dataset2']],
  'footer').

PREDICATE: scattergraph_w1/8:

scattergraph_w1(Header, GT, XT, XVector, YT, YVectors, PAtts, Footer)

This predicate is quite similar to scattergraph_b1/8 except in the following:

Example:

scattergraph_w1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  'yaxixtitle',
  [[10,35,40],[25,20,60]],
  [['e1','Blue','Green'],['e2','MediumVioletRed','Plum']],
  'footer').

PREDICATE: scattergraph_w1/12:

scattergraph_w1(Header, GT, XT, XV, XMax, XMin, YT, YVs, YMax, YMin, PAtts, Footer)

This predicate is quite similar to scattergraph1_b1/13, the differences between them are listed below:

Example:

scattergraph_w1('This is the header text',
  'Graph_title',
  'xaxistitle',
  [20,10,59],
  150,
  5,
  'yaxixtitle',
  [[10,35,40],[25,20,60]],
  _,
  -10,
  [['e1','Blue','Yellow'],['e2','MediumTurquoise','Plum']],
  'footer').

REGTYPE: vector/1:
vector(X) :-
        list(X,number).

The type vector defines a list of numbers (integers or floats).

REGTYPE: smooth/1:

smooth(Smooth)

smooth(linear).
smooth(cubic).
smooth(quadratic).
smooth(step).

Specifies how connecting segments are drawn between data points. If Smooth is linear, a single line segment is drawn, connecting both data points. When Smooth is step, two line segments will be drawn, the first line is a horizontal line segment that steps the next X-coordinate and the second one is a vertical line, moving to the next Y-coordinate. Both cubic and quadratic generate multiple segments between data points. If cubicis used, the segments are generated using a cubic spline. If quadratic, a quadratic spline is used. The default is linear.

REGTYPE: attributes/1:
attributes([ElementName]) :-
        atomic(ElementName).
attributes([ElementName,OutLine,Color]) :-
        atomic(ElementName),
        color(OutLine),
        color(Color).
attributes([ElementName,Symbol,Size]) :-
        atomic(ElementName),
        symbol(Symbol),
        size(Size).
attributes([ElementName,OutLine,Color,Symbol,Size]) :-
        atomic(ElementName),
        color(OutLine),
        color(Color),
        symbol(Symbol),
        size(Size).

Each line or point dataset in the graph has its own attributes, which are defined by this type. The name of the dataset, specified in the ElementName argument, may be either a number or an atom. The second argument is the color of a thin line around each point in the dataset and the Color argument is the points and lines color. Both OutLine and Color must be a valid color (see available values in color/1), otherwise a random color according to the plot background color will be selected. The Symbol must be a valid symbol and the Size must be a number. Be careful if you want to especify the Symbol and the Size, otherwise the predicate will not work as you expect. If you don't select a symbol and a size for a dataset the default values will be square and 1 pixel.

REGTYPE: symbol/1:

symbol(Symbol)

symbol(square).
symbol(circle).
symbol(diamond).
symbol(plus).
symbol(cross).
symbol(splus).
symbol(scross).
symbol(triangle).

Symbol stands for the shape of the points whether in scatter graphs or in line graphs.

REGTYPE: size/1:

size(Size)

size(Size) :-
        number(Size).

Size stands for the size in pixels of the points whether in scatter graphs or in line graphs.


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