Line graph widgets

Author(s): Isabel Martín García.

This module defines predicates which show line graph widgets. All eight predicates exported by this module plot two-variable data. Each point is defined by its X-Y coordinate values. Every predicate share the following features:

  • A dataset is defined by three lists xvector, yvector and attributes. The arguments named XVectors (or XVs), YVectors (or YVs) and LAtts

    Note: In scatter graphs the attibute that contains the features of a point dataset is PAtts.

    contain this information. Those arguments must be lists whose elements are also lists. The first dataset is defined by the firts element of the three lists, the second dataset is defined by the second element of the three lists and so on.

  • Numeric values for the vector elements are needed. We will use two vectors to represent the X-Y coordinates of each set of data plotted. In these predicates the vectors can have different number of points. However, the number of elements in xvector and yvector that pertain to a certain dataset must be, obviously, equal.

  • The active line color is blue, which means that when you select a legend element, the corresponding line turns into navyblue.

  • The user can either select the appearance for the lines and the points or not. See the attributes/1 type definition. Thus, the user can call each predicate in different ways ways.

  • The graph has a legend and one entry (symbol and label) per dataset.

  • If you do not want to display text in the elements header, barchart title, xaxis title, yaxis title or footer, simply give as the value of the argument.

  • The predicates check whether the format of the arguments is correct as well. The testing process involves some verifications. If one or both vectors are empty, the exception error2 will be thrown. If the vectors contains elements but are not correct, the exception error4 will be thrown.


Documentation on exports

PREDICATE
graph_b2(Header,GTitle,XTitle,XVectors,YTitle,YVectors,LAtts,Footer,Sm)

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

  • The plotting area background color is black.

  • The cross hairs color is white.

  • The axis limits are determined from the data.

Example:

graph_b2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[20,30,59],[25,50]],
  'yaxixtitle',
  [[10,35,40],[25,50]],
  [['line1','Blue','Yellow'],['line2']],
  'footer',
  'natural').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GTitle is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XTitle is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVectors is a list of vectors.
    (genbar1:title/1)YTitle is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVectors is a list of vectors.
    (basic_props:list/2)LAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.
    (gengraph1:smooth/1)gengraph1:smooth(Sm)

PREDICATE
graph_b2(Header,GT,XT,XVs,XMax,XMin,YT,YVs,YMax,YMin,LAtts,Footer,Smooth)

In addition to the features brought up at the begining of the module chapter, this graph has the following:

  • The plotting area background color is black.

  • The cross hairs color is white.

  • You can set the maximum and minimum values for the graph axes.

Example:

graph_b2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[20,10,59],[15,30,35]],
  50,
  _,
  'yaxixtitle',
  [[10,35,40],[25,50,60]],
  50.5,
  _,
  [['line1','Blue','Yellow'],['line','MediumTurquoise','Plum']],
  'footer',
  'step').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(XMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(XMin)
    (genbar1:title/1)YT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(YMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(YMin)
    (basic_props:list/2)LAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.
    (gengraph1:smooth/1)gengraph1:smooth(Smooth)

PREDICATE
graph_w2(Header,GT,XT,XVectors,YTitle,YVectors,LAtts,Footer,Smooth)

This predicate is quite similar to graph_b2/9. The difference lies in the graph appearance, as you can see below.

  • The plotting area background color is white.

  • The cross hairs color is black.

Example:

graph_w2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[10,30,59],[25,50]],
  'yaxixtitle',
  [[10,35,40],[25,40]],
  [['element1','Blue','DarkOrchid'],['element2','DarkOliveGreen',
    'Firebrick']],
  'footer',
  'natural').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVectors is a list of vectors.
    (genbar1:title/1)YTitle is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVectors is a list of vectors.
    (basic_props:list/2)LAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.
    (gengraph1:smooth/1)gengraph1:smooth(Smooth)

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

This predicate is comparable to graph_b2/13. The differences lie in the plot background color and in the cross hairs color, wich are white and black respectively.

Example:

graph_w2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[10,30,59],[10,35,40]],
  80,
  _,
  'yaxixtitle',
  [[10,35,40],[25,50,60]],
  50,
  _,
  [['element1','Blue','Green'],['element2','Turquoise','Black']],
  'footer',
  'linear').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XV is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(XMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(XMin)
    (genbar1:title/1)YT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(YMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(YMin)
    (basic_props:list/2)LAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.
    (gengraph1:smooth/1)gengraph1:smooth(Smooth)

PREDICATE
scattergraph_b2(Header,GT,XT,XVectors,YT,YVectors,PAtts,Footer)

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

  • The plotting area background color is black.

  • The cross hairs color is white.

  • The axis limits are determined from the data.

Example:

scattergraph_b2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[10,15,20],[8,30,40]],
  'yaxixtitle',
  [[10,35,20],[15,11,21]],
  [['element1','Blue','Yellow'],['element2','MediumTurquoise','Plum']],
  'footer').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVectors is a list of vectors.
    (genbar1:title/1)YT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVectors is a list of vectors.
    (basic_props:list/2)PAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.

PREDICATE
scattergraph_b2(Header,GT,XT,XVs,XMax,XMin,YT,YVs,YMax,YMin,PAtts,Footer)

The particular features related to this predicate are described below:

  • The plotting area background color is black.

  • The cross hairs color is white.

  • You can set the minimum and maximum limits of the axes. Data outside the limits will not be plotted.

Example:

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

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(XMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(XMin)
    (genbar1:title/1)YT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(YMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(YMin)
    (basic_props:list/2)PAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.

PREDICATE
scattergraph_w2(Header,GTitle,XTitle,XVs,YTitle,YVs,PAtts,Footer)

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

  • The plotting area background color is black.

  • The cross hairs color is white.

  • If the user do not provide the colors of the points, they will be chosen among the lighter ones.

Example:

scattergraph_w2('This is the header text',
  'Graph_title',
  'xaxistitle',
  [[20,30,40,15,30,35,20,30]],
  'yaxixtitle',
  [[10,30,40,25,20,25,20,25]],
  [['set1','cross',4]],
  'footer').

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GTitle is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XTitle is a text (an atom) to be used as label, usually not very long.
    (gengraph1:vector/1)gengraph1:vector(XVs)
    (genbar1:title/1)YTitle is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVs is a list of vectors.
    (basic_props:list/2)PAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.

PREDICATE
scattergraph_w2(Header,GT,XT,XVs,XMax,XMin,YT,YVs,YMax,YMin,PAtts,Footer)

This predicate is comparable to scattergraph_w2/13, the differences between them are listed below:

  • The plotting area background color is white.

  • The cross hairs color is black.

Example:

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

Usage:

  • The following properties should hold at call time:
    (genbar1:header/1)Header is a text (an atom) describing the header of the graph.
    (genbar1:title/1)GT is a text (an atom) to be used as label, usually not very long.
    (genbar1:title/1)XT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)XVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(XMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(XMin)
    (genbar1:title/1)YT is a text (an atom) to be used as label, usually not very long.
    (basic_props:list/2)YVs is a list of vectors.
    (genbar1:axis_limit/1)genbar1:axis_limit(YMax)
    (genbar1:axis_limit/1)genbar1:axis_limit(YMin)
    (basic_props:list/2)PAtts is a list of attributess.
    (genbar1:footer/1)Footer is a text (an atom) describing the footer of the graph.