Specifying Colors in SASGRAPH Programs


Specifying Colors in SAS/GRAPH Programs

SAS/GRAPH software lets you set color

  • in any procedure that generates graphics output (refer to the chapter for the individual procedure).

  • in global statements that enhance procedure output: AXIS, FOOTNOTE, LEGEND, NOTE, PATTERN, SYMBOL, and TITLE (see Chapter 7, SAS/GRAPH Statements, on page 121).

  • in the options on the GOPTIONS statement that defines default colors for graphics elements (see Specifying Default Colors in a GOPTIONS Statement on page 92).

  • in the COLORS= option of the GOPTIONS statement to define a colors list (see Defining and Using a Colors List on page 93).

  • in the colors list of the current device driver. (See Colors and Device Capabilities on page 103 for general information about device capabilities. See Example 1 on page 936 for information on how you can view or modify a device s color list.)

These specifications, alone or in combination, give SAS/GRAPH software the colors it needs to generate graphics output. Colors can be specified using color names, such as RED, or color codes, such as CXFF0000. Color names must not exceed 64 characters. Color codes must not exceed eight characters . All color values must be in a valid SAS color-naming scheme (see Color-Naming Schemes on page 95).

Color specifications are searched for in the following order:

  1. colors specified in the procedure itself

  2. colors specified in global statements

  3. color options in GOPTIONS

  4. the COLORS list in the GOPTIONS statement

  5. the color list in the current device driver.

SAS/GRAPH will search the color specifications in the order outlined above until a valid color is found. If no valid colors are specified, the color will be retrieved from the color list of the current device driver.

Specifying Default Colors in a GOPTIONS Statement

The GOPTIONS statement has several graphics options that specify default colors for graphics elements:

Option

Sets default color for

CBACK=

background for graphics output

CBY=

BY lines in graphics output

CPATTERN=

PATTERN statements

CSYMBOL=

SYMBOL statements

CTEXT=

all text and the border in graphics output

CTITLE=

border, plus all titles, footnotes, and notes

SAS/GRAPH software uses these values if you do not explicitly select colors in other statements. Refer to Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261 for complete information about each of these graphics options.

If you have not explicitly specified a color in a SAS statement or set a default color for a graphic element in the graphics output, SAS/GRAPH software searches for a colors list.

Defining and Using a Colors List

If SAS/GRAPH software does not find a color specification on a procedure or global statement, and a default color for the graphic element is not specified in the GOPTIONS statement, then SAS/GRAPH uses colors from the following colors list:

  1. the COLORS= option on a GOPTIONS statement

  2. the color list of the current device driver. (Use the GTESTIT procedure Example 2 on page 1292 to view the color list for a device driver.)

The color selected from the colors list varies depending on the procedure using the color and the graphics element that is being drawn. Usually, the first color in the list is used; however, certain procedures may select other colors. For example, if the CAXIS= option is not specified in the GCONTOUR procedure s PLOT statement, the procedure selects the second color from the colors list to draw the axes. See the documentation for an individual procedure for more information.

Building a Colors List

To build a colors list, use the COLORS= option on the GOPTIONS statement. This specified colors list overrides the colors list of the current device driver. Building a colors list is useful for selecting a subset of colors to be used in a specific order for graphics output. For example, to ensure that the colors red, green, and blue are available in that order, you can specify:

 goptions colors=(red green blue); 

Each value you specify in a color list must be either a valid color name or a valid color code. Color names must not exceed 64 characters and color codes must not exceed eight characters. For an explanation of SAS color names and codes, see Color-Naming Schemes on page 95.

SAS provides, in the SAS Registry, a set of ordinary-language color names that you can use for colors that are common to most Web browsers. For a list of these names, showing both the ordinary-language name and its associated RGB value, you can run the following code and view the output in the Log window:

 proc registry list   startat=COLORNAMES;  run; 

You can also modify entries in this list and add your own names and their associated RGB values. For more information on viewing and modifying the list of color names, see Using the SAS Registry to Control Color in SAS Language Reference: Concepts .

Note: The COLORS= graphics option only provides a default lookup table. Any time you explicitly select any other colors in your SAS/GRAPH program, those colors are used to draw the graphics elements for which you have specified them.

For a pen plotter, SAS/GRAPH software uses the order of the colors in the COLORS= graphics option to define the order of pens for a multiple pen plotter, or to make a pen plotter prompt you to change the pen when a graph uses more colors than the plotter has loaded.

Using a Device s Default Colors List

If you do not define a colors list with the COLORS= graphics option, then SAS/GRAPH software uses the colors list from the current device driver. This colors list is found in the device entry of the specified device driver (for details on specifying a device driver, refer to Chapter 36, The GOPTIONS Procedure, on page 1075). The colors list will change if you select a different device driver during a SAS session and have not specified the COLORS= graphics option.

To view and modify the device s default colors list, use the GDEVICE procedure (for details, refer to Chapter 31, The GDEVICE Procedure, on page 915).

Overriding the Default Colors List

If you do not specify colors for certain graphics elements or do not specify a colors list with the COLORS= graphics option, then the SAS/GRAPH procedures assign colors from the colors list of the current device driver. In some procedures, this assignment takes up some of the 256 colors that you can specify for a graph. For example, if no colors are specified, the G3D procedure uses the first three colors from the colors list to draw the text, the plot axes, and the plot symbols. These colors take up three of the 256 colors that you can specify for the graph. Therefore, you can specify 253 additional colors for your graph before a warning is issued and the colors are remapped.

To use only the colors that you explicitly specify in your SAS program, submit

 goptions colors=(none); 

The colors from any elements that have a color explicitly specified in your SAS program are combined to form a color list. This color list is used to assign colors to the elements that do not have a color explicitly specified. If no colors are explicitly specified, black will be used. This setting is useful if you want to generate graphics output with the maximum of 256 colors, and you do not want to use any of the default colors from the current device driver.

Resetting the Colors List to the Default

If you have specified a colors list with the COLORS= graphics option and you want to reset it back to the default colors list for the current device driver, then specify

 goptions colors=(); 

Applying ODS Styles

If you are using ActiveX or Java device drivers to produce your graphic output, then you can specify Output Delivery System (ODS) styles to be used for your output s colors. The ODS styles contain predefined color schemes that can be used to create professionally styled graphic output. The ODS styles are available for both bar graphs and pie charts . For more information on ODS Styles see Using ODS Styles on page 488 and SAS Output Delivery System: User s Guide .

Color-Naming Schemes

The valid color-naming schemes are

  • RGB (red green blue)

  • CMYK (cyan magenta yellow black)

  • HLS (hue lightness saturation)

  • HSV (hue saturation brightness), also called HSB

  • gray scale

  • SAS color names (from the SAS Registry)

  • the SAS Color Naming System (CNS).

For the CMYK color scheme, color specifications must be enclosed in quotation marks. For the SAS color names and CNS names, quotation marks are required if the color name contains spaces. In all other instances, quotation marks are optional.

You can freely intermix colors using different color-naming schemes in your programs. However, depending on your device capabilities, the color that is displayed may not be the color that you expect. See Colors and Device Capabilities on page 103 for information on how to tell if your device supports user-defined colors.

Selecting a Color-Naming Scheme

Each of the color-naming schemes supported by SAS/GRAPH offer their own set of advantages and disadvantages based on how the color-naming scheme and desired color will be implemented. RGB and CMYK are older hardware-oriented color-naming schemes. Creating specific RGB or CMYK colors may be less intuitive than creating colors using the user-oriented color-naming schemes: HLS, HSV, gray scale, SAS named colors, or CNS colors. For both hardware-oriented and user-oriented color-naming schemes, the color utility macros allow you to create colors for a specific color-naming scheme and convert color values between color-naming schemes (see Using the Color Utility Macros on page 100 for more information).

Hardware-Oriented Color-Naming Schemes Overview

The RGB color-naming scheme is usually used to define colors for a display screen. This color-naming scheme is based on the properties of light. With this color system, a color is defined by its red, green, and blue components . Individual amounts of each color are added together to create the desired result. All the colors combined together create white and the absence of all color is black.

CMYK is a special color-naming scheme used in four-color printing. Whereas the RGB scheme is based upon the principles of light, the CMYK scheme is based upon the principles of objects reflecting light. Cyan, magenta, and yellow absorb red, green, and blue light, respectively. When cyan is set at maximum, for example, all the red light is absorbed. Combining equal values of cyan, magenta, and yellow produces black, but this color may appear brown when printed. Therefore, the black component (K) of CMYK may be used to specify the level of blackness in the output. A lack of all colors produces white when the output is printed on white paper.

RGB Color Codes

You can use the RGB color-naming scheme to specify a color in terms of its red, green, and blue components. Color names are of the form CX rrggbb , where

  • CX indicates that this is an RGB color specification

  • rr is the red component

  • gg is the green component

  • bb is the blue component.

The components are given as hexadecimal numbers in the range 00 through FF (0% to 100%), where lower values are darker and higher values are brighter. This allows for up to 256 levels of each color component (over 16 million different colors). For example, bright red is specified as CXFF0000, white as CXFFFFFF, black as CX000000, and green as CX00FF00.

Any combination of the color components is valid. Some combinations will match the color produced by predefined SAS color names. See SAS Language Reference: Concepts for information on viewing the RGB combinations that match predefined SAS color names.

Note: When printed, RGB color values are automatically converted to the CMYK color values so that the colors display appropriately in the output.

CMYK Color Codes

To specify the colors from a printer s Pantone Color Look-Up Table, you can use the CMYK color-naming scheme to specify colors in terms of their cyan, magenta, yellow, and black components. Color names are of the form ccmmyykk , where

  • cc is the cyan component

  • mm is the magenta component

  • yy is the yellow component

  • kk is the black component.

The components are given as quoted hexadecimal numbers in the range 00 through FF, where higher values are darker and lower values are brighter. This scheme allows for up to 256 levels of each color component. For example, red is specified as 00FFFF00 , green as FF00FF00 , process black (using cyan, magenta, and yellow ink) as FFFFFF00 , and pure black (using only black ink) as 000000FF . For CMYK color specifications, the quotes are required.

CMYK color specifications should only be used for devices that support four colors. If a CMYK color is used on a three-color device, the color specification will be mapped to a color that the device supports, but the resulting colors may not be appealing. Moreover, different CMYK colors may map to the same device color because a four-color space supports more colors than a three-color space.

Note: You can specify a CMY value by making the kk , the color s black component, zero (00).

User-Oriented Color-Naming Schemes Overview

The HLS color-naming scheme follows the Tektronix Color Standard illustrated in Figure 6.1 on page 98. To make the HLS color model consistent with the HSV coordinate system, Tektronix places blue at zero degrees. With the HLS color naming-scheme you specify the hue, lightness, and saturation levels.

click to expand
Figure 6.1: Tektronix Color Standard

With the HSV color-naming scheme, you specify the hue, saturation, and value (brightness) levels.

The gray scale color-naming scheme allows you to specify the lightness or darkness of gray using the word GRAY and a lightness value.

A predefined list of the SAS color names and their accompanying RGB values are contained in the SAS Registry Editor. The SAS Registry Editor also allows you to add your own SAS color names. With these colors, you can specify the name itself or the RGB value associated with that color name.

With CNS, you develop your color value by selecting and combining valid lightness, saturation, and hue terms. The CNS colors are based on the HLS color model and will display fairly uniform transitions between color values.

Note: Invalid color values will be replaced by the next valid color value on the foreground color list. Messages are written to the SAS log detailing the colors substituted for invalid color values.

HLS Color Codes

You can use the HLS color-naming scheme to specify colors in terms of hue, lightness, and saturation components. SAS/GRAPH software uses an HLS color scheme that is modeled directly after the Tektronix Color Standard illustrated in Figure 6.1 on page 98. HLS color names are of the form H hhhllss , where

  • H indicates that this is an HLS color specification

  • hhh is the hue component

  • ll is the lightness component

  • ss is the saturation component.

The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the lightness and saturation components are hexadecimal and scaled to a range of 0 to 255 expressed with values of 00 through FF (0% to 100%). Thus, they provide 256 levels for each component. For example, blue is specified as H00080FF and light gray as H000BB00. When the saturation is set to 00, the color is a shade of gray that is determined by the lightness value. Therefore, white is defined as H xxx FF00 and black as H xxx 0000, where xxx can be any hue.

HSV (or HSB) Color Codes

You can use the HSV color-naming scheme to specify colors in terms of hue, saturation, and value (or brightness) components. HSV color names are of the form V hhhssvv , where

  • V indicates that this is an HSV color specification

  • hhh is the hue component

  • ss is the saturation component

  • vv is the value or brightness component.

The components are given as hexadecimal numbers. The hue component has the range of 000 through 168 hexadecimal (168 hexadecimal is equivalent to 360 decimal). Both the saturation and value (brightness) components are hexadecimal and scaled to a range of 0 to 255 expressed with values of 00 through FF (when the saturation is set to 00, the color is a shade of gray determined by the value). Thus, they provide 256 levels for each component.

For example, blue is specified as V0F0FFFF, light gray as V xxx 00BB, and white as V xxx 00FF, where xxx can be any hue. For white and black, the value component determines the intensity of gray level.

Gray-Scale Color Codes

Gray-scale color names are of the form GRAY ll . The value ll is the lightness of the gray and is given as a hexadecimal number in the range 00 through FF. This scheme allows for 256 levels on the gray scale. For example, GRAYFF is white, GRAY00 is black, and GRAY4C is a dark gray.

SAS Color Names and RGB Values

The SAS Registry Editor contains valid color names and RGB values. The predefined color names and RGB values in the SAS Registry are common to most web browsers. In addition to viewing predefined SAS color names and RGB values, the SAS Registry Editor also allows you to create and define your own color names and RGB values. See SAS Language Reference: Concepts for more information.

Note: Hardware characteristics may cause some colors with different color definitions to appear the same. Also, the same predefined color is likely to appear different on different devices and may not appear correctly on some devices.

CNS Color Names

You can specify a CNS color value s lightness, saturation, and hue using the following terms:

Table 6.1

Lightness

Saturation

Hue

Black

Gray

Blue

Very Dark

Grayish

Purple

Dark

Moderate

Red

Medium

Strong

Orange/Brown

Light

Vivid

Yellow

Very Light

 

Green

White

   

CNS values should be written in the following order: lightness saturation hue . The color names may written without space separators between words, with an underscore to separate words, or with a space to separate words. The following list contains examples of valid color names:

  • verylightmoderatepurplishblue

  • very_light_moderate_purplish_blue

  • very light moderate purplish blue

  • Color names containing spaces must be enclosed in quotation marks.

Note: The %CNS macro only accepts CNS color names where a space is used to separate the words in the color name. See Table 6.5 on page 101 for more information

If a CNS color name is also a color name in the SAS Registry, the SAS Registry color value will be used. Some CNS color names and color names in the SAS Registry have different color values. To use a CNS color value when the color name is also in the SAS Registry, place quotes around the color name.

The lightness values black and white should not be used with saturation or hue values. If not specified, medium is the default lightness value and vivid is the default saturation value. Gray is the only saturation value that can be used without a hue. Unless the CNS value is black, white, or some form of gray, at least one hue value must be used.

One or two hue values can be used in the CNS color name. When using two hue values, the hues must be adjacent to form a color. The hues are located in the following circular order: blue, purple, red, orange/brown, yellow, green, and then returning to blue. When two hues are used, the resulting color is a combination of both colors. Use the suffix ish to reduce the effect of a hue when two hues are combined. For example, reddish purple is less red than red purple. If you are using a color with an ish suffix, this color must precede the color without the ish suffix.

Using the Color Utility Macros

The %COLORMAC macro contains several subcomponent macros that can be used to construct and convert color values for the different color-naming schemes supported by SAS. The %HELPCLR macro provides information about the %COLORMAC subcomponent macros. The following table shows information that will appear in your SAS log when you call the %HELPCLR macro from the comand-line:

Table 6.2: Using the %HELPCLR macro

Use...

To...

%HELPCLR;

List the color utility macro names.

%HELPCLR(ALL);

Display the short descriptions and examples for each of the color utility macros.

%HELPCLR( macroname );

Obtain a short description and an example of a specific color utilities macro. Replace macroname with the name of the color utility macro you are interested in.

When the color utility macros are invoked, the calculated color value can be directed to the SAS log or perform in-place substitutions in the code. The following tables list and describe the color utility macros and provide an usage example of each macro:

Table 6.3: %CMY(cyan, magenta, yellow);

Description

Usage Example

Replace cyan, magenta, yellow with numeric values to create a RGB color value. The numeric values that are used in place of cyan, magenta, yellow indicate the percentage (0 to 100) of each of these colors to be included in the RGB value.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null;   put ''%CMY(100,0,100)'';   run;  

Returns the RGB value CX00FF00 which is green.

Table 6.4: %CMYK(cyan, magenta, yellow, black);

Description

Usage Example

Replace cyan, magenta, yellow, black with numeric values to create a CMYK color value. The numeric values that are used in place of cyan, magenta, yellow, black indicate the percentage (0 to 100) of each of these colors to be included in the CMYK color value. See CMYK Color Codes on page 96 for more information on the color value produced by using this macro.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put %CMYK(0,46,16,31);   run;  

Returns the CMYK value 0075294F which is purple.

Note: In the PUT statement, %CMYK( cyan, magenta, yellow, black ), should not be placed in quotations.

Table 6.5: %CNS(colorname);

Description

Usage Example

Replace colorname with a color-naming scheme color name to create a HLS color value. See HLS Color Codes on page 97 for more information on HLS color values. For more information on valid color-naming scheme color names see CNS Color Names on page 99 or enter the following into the command-line of the Program Editor:

  %HELPCLR(CNS);  

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%CNS(GRAYISH REDDISH PURPLE)'';   run;  

Returns the HLS value H04B8040 which is grayish reddish purple.

Table 6.6: %HLS(hue, lightness, saturation);

Description

Usage Example

Replace hue, lightness, saturation with numeric values to create a HLS color value. Hue should be replaced with any value from 0 to 360. Lightness and saturation indicate a percentage (0 to 100) to be included in the HLS color value. See HLS Color Codes on page 97 for more information.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%HLS(0,50,100)'';   run;  

Returns the HLS value H00080FF which is blue.

Table 6.7: %HSV(hue, saturation, value);

Description

Usage Example

Replace hue, saturation, value with numeric values to create a HLS value from HSV components. Hue should be replaced with any value from 0 to 360. Saturation and value (brightness) indicate a percentage (0 to 100) to be included in the HLS color value. See HSV (or HSB) Color Codes on page 98 and HLS Color Codes on page 97 for more information.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%HSV(0,100,75)'';   run;  

Returns the HSV value V000FFBF which is dark red.

Table 6.8: %RGB(red, green, blue);

Description

Usage Example

Replace red, green, blue with numeric values to create a RGB color value from RGB color components. The numeric valuesthatareused inplace of red,green, blue indicate the percentage (0 to 100) of each of these colors to be included in the RGB color value. See RGB Color Codes on page 95 for more information.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%RGB(100,100,0)'';   run;  

Returns the RGB value CXFFFF00 which is yellow.

Table 6.9: %HLS2RGB(hls);

Description

Usage Example

Replace hls with a HLS color value to create a RGB color value. See HLS Color Codes on page 97 and RGB Color Codes on page 95 for more information.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%HLS2RGB(H04B8040)'';   run;  

Returns the RGB value CX9F5F8F which is grayish reddish purple.

Table 6.10: %RGB2HLS(rgb);

Description

Usage Example

Replace rgb with a RGB color value to create a HLS color value. See RGB Color Codes on page 95 and HLS Color Codes on page 97 for more information.

Entering the following code into your Program Editor:

  %COLORMAC;   data _null_;   put ''%RGB2HLS(CX9F5F8F)'';   run;  

Returns the HLS value H04C7F40 which is grayish reddish purple.

Note: Round-trip conversions using HLS2RGB and then RGB2HLS macros or vice versa, may produce ultimate output values that differ from the initial input values. For example, converting CXABCDEF (a light blue) using %RGB2HLS (CXABCDEF) produces H14ACDAD. Converting this value back to RGB using %HLS2RGB (H14ACDAD) returns CXAACCEE. While not identical, the three colors are very similar on the display and when printed.

For additional information on color-naming schemes, see Effective Color Displays: Theory and Practice by David Travis and Computer Graphics: Principles and Practice by Foley, van Dam, Feiner, and Hughes.

Colors and Device Capabilities

Your graphics output device determines the colors that you can use. SAS/GRAPH software translates the color that you specify to the color definition system on your device. It then checks to see if the color is available. If the color is not available, SAS/GRAPH software produces a message in the Log and remaps the color either to a color that closely matches the color you specified or to the next available color in the colors list. The remapping behavior depends on the capabilities of your device.

Graphics devices can be grouped into the following categories:

  • devices that do not support user-defined colors

  • devices that support user-defined colors

  • pen plotters .

You can determine whether your device supports user-defined colors in two ways:

  • Check the documentation for your graphics device.

  • Run the GTESTIT procedure and display picture 1. The OPTS= string indicates if the device supports user-defined colors. If the second digit of the OPTS= string is an odd integer or d, b, or f, then the driver supports user-defined colors.

Devices That Do Not Support User-defined Colors

Devices that do not support user-defined colors are those that come with predefined nonalterable color palettes. These devices have a palette of between 1 and 256 predefined colors, but the actual number of colors that can be displayed at one time may be less than that.

When using devices that do not support user-defined colors, you can specify colors using any color-naming scheme; however, any unsupported colors that you specify in RGB, HLS, or gray-scale format are remapped to colors in your device s default colors list. Some devices try to match the user-defined color with the closest color in the device s color palette. Others merely remap the color to the next available color in the device s color palette. To avoid having colors remapped, use the colors in your device s default colors list.

Devices That Support User-defined Colors

Devices that support user-defined colors are graphics devices that allow you to configure the colors from the device s color palette. A device in this category may have a palette of over 16 million colors, but it may only be able to display a subset of colors from the color palette at any one time.

On a device that supports user-defined colors, you can use any color-naming scheme to specify colors. If you specify a color that your device does not support, SAS/GRAPH software remaps the color to an available color that is the closest match.

Pen Plotters

The colors you can use with a pen plotter are determined by your set of pens. You specify the color names in the GOPTIONS statement s COLORS= option, then place pens with those color names in the plotter when the following message appears (the message does not appear if you specify the NOPROMPT graphics option):

 Please mount the following pens: ... 

By default, SAS/GRAPH software tries to keep a standard set of pens in the plotter s carousel . If colors in the standard set of pens are named in the COLORS= graphics option, a mount request is issued for the entire standard set, even if all of them are not used in the output. This minimizes the number of times pens must be reshuffled as a graph is being drawn. If GOPTIONS COLORS=(NONE) is used, you are only prompted to mount pens for the colors that are actually used in the output.

Note: You can specify any valid SAS name for a color when using a pen plotter. It does not have to be a predefined or user-defined color name. For example, you can specify COLOR=PEN3, and you will be prompted to mount PEN3 or SAS/GRAPH software will assume a pen of that color is in the appropriate slot. This feature is often helpful if you are using transparency pens or other special pens.

Limitations

Using colors in SAS/GRAPH software is limited by the number of colors that you can use in one graph and by the capabilities of your device. The following sections discuss these limitations.

Maximum Number of Colors Displayable in SAS/GRAPH Software

  • You can use a maximum of 256 unique colors on each graph, including the background color (specified with the CBACK= graphics option or the CBACK device parameter). If you use more than 256 unique names in a program, SAS/GRAPH software issues a warning and remaps the 257th and any subsequent colors to existing color names, beginning with the first color name in the existing color list.

  • Note: If you specify a color using two different color-naming schemes for the same graph (for example, WHITE and RGB white, CXFFFFFF), SAS/GRAPH software counts them as two color specifications out of the 256 colors that you are allowed to use on one graph.

Maximum Number of Colors Displayable on a Device

  • The number of colors that you can display is limited by the type of graphics output device that you have. If you generate a graph with more colors than the device can display, the colors that cannot be displayed are mapped to an existing color. You may also receive a note in the SAS log telling you when a color is mapped to another color in the colors list and what color will be used instead.

  • Although your device may support 256 colors, it may not let you use all of them at once. The MAXCOLORS device parameter tells SAS/GRAPH software the maximum number of colors that can be displayed at one time. MAXCOLORS is the number of foreground colors plus the background color and has a range of two to 256. If you use more than the number of colors set by the MAXCOLORS device parameter, the excess colors are remapped.

  • Note: The MAXCOLORS device parameter defaults to the number of displayable colors on the basic model of each graphics device supported. If your graphics device can display more colors than the base model, use the PENMOUNTS= graphics option to specify the number of colors that can be displayed. Optionally, you can use PROC GDEVICE to modify the value of the MAXCOLORS device parameter.

  • For pen plotters, you use the PENMOUNTS= graphics option to indicate the number of pen holders on the plotter. PENMOUNTS is the number of foreground colors and has a range of one to 255. PENMOUNTS does not include the background color. Using this graphics option does not limit the number of colors that you can specify for a graph that is produced on a pen plotter. If you use more colors than the plotter has pen holders, you will be prompted to change pens unless you have also specified the NOPROMPT graphics option.

Replaying Graphs on a Device That Displays Fewer Colors

  • You can use the GREPLAY Procedure to display graphs previously generated. Sometimes you may need to replay the graphs on a device that cannot display as many colors as the device on which the graph was originally developed. Use CMAP on page 270 to control some of the remapping.

  • When you replay graphs on devices that display fewer colors than are in the graph, two situations may cause problems:

    • Colors are specified that the device does not support.

    • More colors are specified than the device can display at one time.

  • If you specify colors on a device that does not support those colors, the colors are remapped to those available for that device. You may also receive a note in the SAS log telling you when a color is mapped to another color in the colors list and what the new color is.

  • The number of colors that your device can display affects the actual color displayed. If your graphics output device can generate a maximum of 64 distinct colors and your graph contains 256 colors, the 65th through the 256th color specifications are remapped to the device s available colors and may not display as the color you specify.

  • You can use the TARGETDEVICE= graphics option to preview the way a graph is going to look on a different device. You set this graphics option to the device entry name of the device driver that will be used later. The graph is displayed as close as possible to the way it will display when the other device is used.

  • Note: When you use the TARGETDEVICE= graphics option, SAS/GRAPH software uses the colors list of the target device as the default colors list; any color that you explicitly use is displayed when you preview the graph, although the target device may cause the color to be mapped. Refer to TARGETDEVICE on page 355 for complete information about the TARGETDEVICE= graphics option.

Trueness of Color Displayed on a Device

  • The size of the color palette in your device determines the trueness of the color that is actually produced. For example, a device with a palette of 64 colors can only produce colors that contain a combination of four shades of red (including no red), four shades of green (including no green), and four shades of blue (including no blue). Consequently, ranges of color will be remapped to available colors. For example, color specifications CX008080, CX258080, and CX3F8080 will all look the same (no red). CX408080 through CX7F8080 will look redder; CX808080 through CXBF0000, redder still; and CXC08080 through CXFF8080, the reddest. Larger palettes have more color resolution but may not have more simultaneous colors.




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net