Author(s): Isabel Martín García.
Version: 1.11#222 (2004/5/24, 13:8:7 CEST)
Version of last change: 1.11#148 (2004/1/1, 14:17:31 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:
attributes/1
type definition and see the examples to understand it clearly.
"
as the value of the argument.
error2
will be thrown. If the vectors contains elements but are not correct, the exception error4
will be thrown.
The names of the line graph predicates begin with graph_ and those corresponding to the scatter graph group begin with scattergraph_.
gengraph1
):- use_module(library(gengraph1)).
gengraph1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XVector)
(gengraph1:vector/1
)
YTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVectors
is a list of vector
s.
(basic_props:list/2
)
LAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
gengraph1:smooth(Smooth)
(gengraph1:smooth/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XV)
(gengraph1:vector/1
)
genbar1:axis_limit(XMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(XMin)
(genbar1:axis_limit/1
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVs
is a list of vector
s.
(basic_props:list/2
)
genbar1:axis_limit(YMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(YMin)
(genbar1:axis_limit/1
)
LAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
gengraph1:smooth(Smooth)
(gengraph1:smooth/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XVector)
(gengraph1:vector/1
)
YTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVectors
is a list of vector
s.
(basic_props:list/2
)
LAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
gengraph1:smooth(Smooth)
(gengraph1:smooth/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XV)
(gengraph1:vector/1
)
genbar1:axis_limit(XMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(XMin)
(genbar1:axis_limit/1
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVs
is a list of vector
s.
(basic_props:list/2
)
genbar1:axis_limit(YMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(YMin)
(genbar1:axis_limit/1
)
LAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
gengraph1:smooth(Smooth)
(gengraph1:smooth/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XVector)
(gengraph1:vector/1
)
YTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVectors
is a list of vector
s.
(basic_props:list/2
)
PAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XV)
(gengraph1:vector/1
)
genbar1:axis_limit(XMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(XMin)
(genbar1:axis_limit/1
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVs
is a list of vector
s.
(basic_props:list/2
)
genbar1:axis_limit(YMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(YMin)
(genbar1:axis_limit/1
)
PAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XVector)
(gengraph1:vector/1
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVectors
is a list of vector
s.
(basic_props:list/2
)
PAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
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').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/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.
(genbar1:title/1
)
gengraph1:vector(XV)
(gengraph1:vector/1
)
genbar1:axis_limit(XMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(XMin)
(genbar1:axis_limit/1
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
YVs
is a list of vector
s.
(basic_props:list/2
)
genbar1:axis_limit(YMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(YMin)
(genbar1:axis_limit/1
)
PAtts
is a list of attributes
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
vector(X) :- list(X,number).
The type vector defines a list of numbers (integers or floats).
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 cubic
is used, the segments are generated using a cubic spline. If quadratic
, a quadratic spline is used. The default is linear.
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.
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.
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.