Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2014

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.9 ChIPS v1


Context: concepts


Use of colors in ChIPS.


Color is an attribute of nearly all objects in ChIPS, and there is a vast palette available. This document describes how to specify color values and how to set the color attributes of objects. This document does not describe how color maps are used to color images.

Windows and frames have a background color ("bgcolor"); frames also have a border color attribute. There are "color" properties of many other objects: axes, contours, labels, lines, and points. Regions have an edge color attribute as well as a fill color attribute. The help files for the set_<object> commands list the color attributes for each object.

Specifying Colors

Colors may be specified by name ("lime", "gray", "black") or as hex values (RRGGBB where 0xff0000 = Red, 0x00ff00 = Green, 0x0000ff = Blue). A list of recognized color names is available in the Color section of "ahelp chipsopt".

When using a numerical representation of a color as a string, the 0x prefix is omitted and the string must contain 6 digits (RRGGBB):

set_line(["color", "fa4812"])


c = ChipsCurve()
c.symbol.color = "ff0000"
c.line.color = "blue"

When using numeric values for colors (i.e. paired attribute lists or attribute structures), they should be prefixed by 0x. The 0x prefix discerns between decimal and hex values.

set_line(["color", 255])
p = ChipsPoint()
p.color = 0xfa4812

Default Color

ChIPS is designed not only for graphically displaying plots on the screen but also for generating publication-ready hardcopy plots. To facilitate the transition of plots from the screen to paper, ChIPS has foreground and background color preferences for the screen and for postscript output.

foreground.file        : black
background.file        : white
foreground.display     : white
background.display     : black

The default values are black background with white lines in the ChIPS window and the inverse on printout or when saving to a file (white background, black lines).

These default setting can be modified with the set_preference command:

set_preference("foreground.display", "yellow")
set_preference("background.display", "navy")

Changing the foreground.display and background.display preferences

Changing either, or both, the foreground.display and background.display preference settings changes all existing windows, as well as new ones.

CMYK Support

CMYK support is provided for postscript and encapsulated postscript output formats. In the print_window command, specify CMYK ("cmyk") or separated CMYK components ("cmyksep"), which creates four output files.

print_window("example1", "colorscheme=rgb")
print_window("example2", "colorscheme=cmyk")
print_window("", "colorscheme=cmyksep")

Example 1

chips> set_window(["bgcolor", "red")]
chips> set_frame(["bgcolor", "0000ff"])

The background color of the window is set to red. The frame background color is set to blue, using a hex value. The window color will not be seen if the frame covers the whole window and is not transparent.

Example 2

chips> att = ChipsCurve()
chips> att.line.color = "lime"
chips> att.symbol.color = 0xff00
chips> set_curve(att)

Populate the "att" structure with attribute values, then use it to set the line color to lime and the symbol color to green (0xff00).

Example 3

chips> set_preferences({"foreground.display": "plum",
"background.display": "snow"})
chips> add_window(5, 3, "inches")
chips> add_frame(0.1, 0.1, 0.9, 0.9, ["bgcolor", "azure"])

Set the default display foreground color to plum and the default display background color to snow. Create the window, then add a frame with a uniform margin and azure colored background.

Example 4

chips> set_preference("", "solid")
chips> add_region(5, 0.5, 0.5, 0.3, ["fill.color", 255])
chips> add_region(3, 0.4, 0.6, 0.3, ["fill.color", 0xff0000])

Set the region fill preference to true, then create a pentagon-shaped region with a blue fill color. Add a translucent red triangle overlapping the pentagon.


See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.

See Also

chips, chipsgui, chipsrc, show_gui
aspectratio, attributes, chipsid, chipsopt, coordsys, currency, depthcontrol, entitycreation, preferences, setget

Last modified: December 2014
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.