Contents Previous Next Subchapters

Setting The Line Plotting Style
Syntax gstyle(style)
gstyle(
stylewidth)
gstyle(
stylewidthsize)
See Also gplot

Description
Sets the style for plotting lines in the current viewport, where style is equal to one of the following character row vectors:
Lines Points Polygons Filled
"solid" "dot" "triangle" "filltriangle"
"dotted" "star" "square" "fillsquare"
"dashed" "plus" "diamond" "filldiamond"
"cross" "circle" "fillcircle"


The integer scalar width specifies a plotting line width in pixels and must be a positive odd value. This width is used to plot the axes, tick marks and grid lines. In addition, it is used for subsequent lines that are plotted in the viewport. If width is not specified, a value of 1 is used.

The integer scalar size specifies the symbol size in 10 times printer point units and must be positive. If size is not specified, a value of 40 is used.

Example
     ginit
     gstyle("diamond")
     gplot({1, 2, 3}, {10, 20, 30})
will plot diamonds at the points (1, 10), (2, 20), and (3, 30).

If style is specified in the gplot command, that style is used for that command only.
     ginit
     gstyle("diamond")
     gplot({1, 2, 3}, {10, 20, 30}, "solid")
     gplot({1, 2, 3}, {10, 20, 30})
will plot a line segment between (1, 10) and (3, 30), and diamonds at the points (1, 10), (2, 20), and (3, 30).

You can plot five diamonds at the default size by entering
     ginit
     gstyle("diamond", 1, 40)
     gplot(seq(5))
You can then surround the diamonds by larger ones with thicker lines by entering
     gstyle("diamond", 5, 80)
     gplot(seq(5))
You can then return the axes to their original width by entering
     gstyle("solid", 1)

Style Demonstration
The following program demonstrates all of the plotting styles:

clear
list = { ...
     "solid", ...
     "dotted", ...
     "dashed", ...
     "dot", ...
     "star", ...
     "plus", ...
     "cross", ...
     "triangle", ...
     "square", ...
     "diamond", ...
     "circle", ...
     "filltriangle", ...
     "fillsquare", ...
     "filldiamond", ...
     "fillcircle" ...
}
N = rowdim(list)
gxaxis("linear", 0., 1., 1, 1)
gyaxis("linear", 0., 1., 1, 1)
gcolor("black")
for i = 1 to N begin
     style = strclip(list.row(i))
     x      =  {.1, .2}
     y      =  {i,   i} / double(N + 1)
     gplot(x, y, style)
     p      = gcoord(.3, y(1))
     gaddtext(style, p, [0., .5]);
end