GBARLINE Procedure

Controlling Patterns, Outlines, Colors, and Images

How to Control Patterns, Outlines, Colors, and Images

Default patterns, colors, outlines, and, in some cases, images, are defined by the current style, whether that style is the default GSTYLE or one that you specify with the ODS statement. You can turn off styles by specifying the NOGSTYLE system option. Alternatively, you can override individual aspects of a graph's appearance by specifying PATTERN statements, SYMBOL statements, graphics options, and procedure options.
The following sections summarize pattern behavior for the GBARLINE procedure. For more information, see the PATTERN Statement and the SYMBOL Statement.

Default Patterns, Symbols, Lines, Colors, and Outlines

The default pattern that the GBARLINE procedure uses is a solid fill. The default colors are determined by the current style and the device.
By default, the system option GSTYLE is in effect. As a result, the procedure generates output using the style's default bar fill colors, plot line colors, widths, symbols, patterns, and outline colors. Specifically, the GBARLINE procedure uses the default values when you do not specify any of the following:
  • any PATTERN statements
  • the CPATTERNS= graphics options
  • the COLORS= graphics options
  • the COUTLINE= option in the BAR statement
  • any SYMBOLS statements
If you do not specify any of these statements or options, then the GBARLINE procedure performs the following operations:
  • selects the first default fill pattern, which is always solid, and rotates it through the list of colors available in the current style, generating one solid pattern for each color. When the solid patterns are exhausted, the procedure selects the next default subgroup bar pattern (empty) and rotates it through the appropriate set of colors. It continues in this fashion until all of the required patterns have been assigned.
    If you use the default style colors and the first color in the list is either black or white, the procedure does not create a pattern in that color. If you specify a color list with the COLORS= graphics option, then the procedure uses all the colors in the list to generate the patterns.
  • uses the style's outline color to outline every patterned area.
  • uses the style's default symbol for the initial PLOT statement points. The procedure uses the second default symbol for the next PLOT statement, and the third default symbol for the next PLOT statement. The procedure continues orderly through the set of symbols belonging to that style until all the PLOT statements have been satisfied.
  • connects all the plot symbols with a solid line.
If you specify the NOGSTYLE system option, the fill pattern is solid and the color comes from the device's color list. The GBARLINE procedure uses a solid fill for the bars that it rotates once through the device's default color list, skipping the foreground color. (Typically, the foreground color is the first color in the device's color list.) Suppose no SYMBOL or PATTERN statements are in effect and the COLORS= option is not used in the GOPTIONS statement. In this case the plot line colors begin with the next color from the same color list used to color the bars. By doing this, the procedure prevents the plot line from being the same color as a bar fill. Specifically, GBARLINE performs the following operations:
  • selects the first default fill, which is always solid, and rotates it through the color list, generating one solid pattern for each color. If the first color in the device's color list is black (or white), the procedure skips that color and begins generating patterns with the next color.
  • uses the foreground color to outline every patterned area.
  • selects the next default pattern fill (if it needs additional patterns), and rotates that pattern through the color list, skipping the foreground color as before. The procedure continues in this fashion until it has generated enough patterns for the chart.
  • uses the device's default color to outline every patterned area.
  • selects the next color in the list after the last bar color and uses it to draw the first PLOT statement symbol and connecting line.
  • rotates through the color list for any subsequent PLOT statements.
If the procedure needs additional patterns, PROC GBARLINE selects the next default pattern fill (empty) and rotates it through the color list, skipping the foreground color as before. The procedure continues in this fashion until it has generated enough patterns for the chart.
You might change or override the default behavior for patterns if you specify a color list with the COLORS= option in a GOPTIONS statement. For example, if the COLORS= list contains more than one color, then the procedure rotates the default solid pattern through that list. It uses every color, even if the foreground color is black (or white). The default outline color remains the foreground color or the color specified by the current style.
For a description of the COLORS= or other graphics options, see Graphics Options and Device Parameters Dictionary.

User-Defined Patterns, Colors, Lines, Symbols, and Outlines

To override the default patterns and select fills and colors for the bars, use the PATTERN statement. Only solid and empty bar patterns are valid; all other pattern fills are ignored. For a complete description of all bar patterns, see VALUE=bar/block-pattern .
When you use PATTERN statements, the procedure uses the specified patterns until all of the PATTERN definitions that they generate have been used. Then, if more patterns are required, the procedure returns to the default pattern rotation. To change the outline color of any pattern, whether the pattern is default or user-defined, use the COUTLINE= option in the BAR statement that generates the chart. (See COUTLINE=bar-outline-color | SAME.) To override the default plot colors, symbols, and line widths, use the SYMBOL statement. For a complete description of its parameters, see the SYMBOL Statement. The SYMBOL statements are used in order for each PLOT statement. If there are fewer SYMBOL statements than PLOT statements, default SYMBOL values are used for subsequent plots.

Adding Images to Bar-Line Charts

You can apply images to the bars and to the background of bar-line charts developed with the BAR statement.
You can use PATTERN statements to specify images to fill the bars. For details, see Displaying Images on Data Elements.
You can use the IBACK= graphics option to specify image files that fill the background area. For additional information, including a list of recognized image file types, see Image File Types Supported by SAS/GRAPH and Displaying an Image in a Graph Background.

Controlling When Bar Patterns Change

The PATTERNID= option controls when the pattern changes. By default, all of the bars are the same pattern. If you specify PATTERNID=MIDPOINT, then the pattern changes every time the midpoint value changes.
Instead of changing the pattern for each midpoint, you can change the pattern for each BY group by changing the value of the PATTERNID= option. See PATTERNID=BY | MIDPOINT | SUBGROUP for details.

Controlling Axis Color

By default, axis elements use the first color in the color list or the colors that are specified by AXIS statement color options. However, BAR statement options can also control the color of the axis lines, text, and frame.
Controlling Axis Color
Axis Element.
Specify Color with this Option
the axis text
CTEXT=
the axis lines
CAXIS=
the area within the frame
CFRAME=