SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

BACKGROUND COLOR

Name:
    BACKGROUND COLOR
Type:
    Plot Control Command
Purpose:
    Specifies the color of the background.
Description:
    The background is "painted" whenever a subsequent screen erasure takes place. For 2-dimensional graphics (e.g., PLOT, HISTOGRAM, BOX PLOT, etc.), the background is the region inside the frame lines (while the region outside the frame lines is the "margin"). For 3-dimensional graphics (3D-PLOT), the background region is the entire screen. For diagrammatic graphics (e.g., TEXT, ARC, BOX, CIRCLE, etc..), the background region is also the entire screen. Dataplot provides two methods for specifying colors.

    1. Colors can be defined by name (or by the corresponding index). Dataplot adopted it's named colors from the X11 project. Currently, 162 named colors and 100 levels of grayscale are supported. Grayscale can be specified with either G0, G1, ..., G100 (or -1, -2, ..., -100). Many older devices support only a limited number of colors. For these devices, unsupported colors will be mapped to one of the available colors. To specify a named color, see Syntax 1.

    2. Most modern graphics devices support full RGB (RedBlueGreen) color. You can alternatively specify RGB colors by entering three integer values to represent the Red, Green and Blue components, respectively. These values should be in the range 0 to 255.

    When setting the background color, Dataplot first checks if the device supports RGB colors. If not, the named color will be used. If the device does support RGB color, Dataplot will check if an RGB color has been specified. If yes, then that RGB color is used. If not, the named color will be used.

    To see the list of supported named colors (with the associated index number), see

    https://www.itl.nist.gov/div898/software/dataplot/refman1/ch11/homepage.htm

Syntax 1:
    BACKGROUND COLOR <color>
    where <color> is the desired background color.
Syntax 2:
    BACKGROUND RGB COLOR <ired> <igreen> <iblue>
    where <ired> specifies the red component of the background color;
                <igreen> specifies the green component of the background color;
    and      <iblue> specifies the blue component of the background color.

    The components should be integer values in the range 0 - 255. To turn off the RGB color, set the components to -1 (any negative value will work and if any of the three components is negative the RGB color will be turned off).

Examples:
    BACKGROUND COLOR GREEN
    BACKGROUND COLOR YELLOW
    BACKGROUND COLOR YELLOW
    BACKGROUND RGB COLOR 90 167 102
    BACKGROUND RGB COLOR 110 205 65
Note:
    When you enter the BACKGROUND COLOR command, this will also set the MARGIN COLOR to the same color. If you want the MARGIN COLOR to be different than the BACKGROUND COLOR, then enter the MARGIN COLOR after the BACKGROUND COLOR command.
Note:
    The BACKGROUND COLOR command with no arguments sets the background color to default. For a list of available colors, enter HELP COLOR TYPES.
Note:
    This command is device dependent in that some device may not let you set the background color. In addition, devices vary in the colors that they support.

    Postscript and SVG devices set the background color for the first plot when the device is initialized, not at the first clear screen (e.g., the first PLOT command). For this reason, if you want to set the background color for the first plot, the BACKGROUND COLOR command should be entered before the DEVICE 2 POSTSCRIPT or DEVICE 2 SVG command.

Default:
    The default background color is white.
Synonyms:
    None
Related Commands: Applications:
    Presentation Graphics
Implementation Date:
    Pre-1987
    2021/03: Support for the BACKGROUND RGB COLOR option
Program:
     
    background color cyan
    background rgb color 110 205 65
    .
    line thickness 0.5
    line color yellow
    title case asis
    title offset 2
    title Sample Plot
    label case asis
    x1label x
    y1label x**2
    .
    plot x**2 for x = 1 1 9
        
    plot generated by sample program
Date created: 03/30/2021
Last updated: 12/11/2023

Please email comments on this WWW page to alan.heckert@nist.gov.