Contents Previous Next Subchapters

Line Color Sequence For The Current Viewport
Syntax gcolor
See Also gplot , contour , glevel
Menu Command Graphics | Colors . . .

If the character matrix colors is present, gcolor sets the current color sequence to the specified colors. If colors is not present, gcolor returns the current color sequence.

Unless specified by gcolor, O-Matrix uses the following sequence of colors for plotting: "black", "maroon", "green", "olive", "navy", "purple", "teal", "gray", "silver", "red", "lime", "yellow", "blue", "fuschia", and "aqua". That is, the first line plotted with gplot will be black, the second will be maroon, and so on. The sequence starts over after an aqua plot. (The color sequence is also used by contour and glevel .) The color "white" can be added to the color sequence, but it is not part of the default sequence. It is primarily useful for erasing lines from a plot.

If you enter
     colors = gcolor
     print colors
O-Matrix will print the default color sequence in the Command window. If you then enter
     ncolor = rowdim(colors)
     gxaxis("linear", 0, 20, 4,  5)
     for i = 1 to ncolor begin
          x  = {i, i}
          y  = {0, 1}
          gplot(x, y)
O-Matrix will display one line of each color, with the index of the color in the sequence equal to the x value in the plot.

The gcolor function can be used to define a different sequence of colors. For example, if you enter
     gcolor({"red", "yellow", "green"})
     gplot(1, 4, "triangle")
     gplot(1, 3, "diamond")
     gplot(1, 2, "star")
     gplot(1, 1, "cross")
O-Matrix will generate a graph with a red triangle at (1, 4), a yellow diamond at (1, 3), a green star at (1, 2), and a red cross at (1, 1).