Chapter Contents

Previous

Next
SAS/GRAPH Software: Reference

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 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:

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


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 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.  [cautionend]


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.

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 assumes that those two color specifications are different colors. It counts them as two color specifications out of the 256 colors that you are allowed to use on one graph. On some systems, they may appear as different colors if one of them is a DMS (Display Manager) color.  [cautionend]

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. If you use more than the number of colors in 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.  [cautionend]

For pen plotters, you use the PENMOUNTS= graphics option to indicate the number of pen holders on the plotter. 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 used 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.

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

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 for complete information about the TARGETDEVICE= graphics option.  [cautionend]

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, 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.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.