Last modified: December 2013

URL: https://cxc.cfa.harvard.edu/chips/ahelp/set_label.html
AHELP for CIAO 4.11 ChIPS v1

set_label

Context: labels

Synopsis

Modifies the attributes of an existing label.

Syntax

set_label(attributes)
set_label(id, attributes)

Description

The function arguments.

Argument Description
id A ChipsId structure identifying the item, or a string containing the name of the object.
attributes Configure object properties by giving an attribute string (a space-separated list of key=value pairs), list, dictionary, or a ChIPS object.

The set_label command sets the specified attributes to the provided values. The modified label becomes current. Multiple labels may be modified with a single command by setting the currency to "all".

Customizing the Label

There are several attributes that control the characteristics of labels. The set_label command may be used to modify the attribute values of an existing label at any time during a ChIPS session. See "ahelp attributes" and "ahelp setget" for more general information.

If multiple attributes are being set simultaneously and one of them fails, the entire command will fail and the label will not be modified.

Please see the section "Label Preferences and Attributes" below the examples for a list of the label attributes.

Note that the label text is not included in the attributes. In order to set the text, use the set_label_text command.

Advanced Functions

The module of advanced ChIPS functions contains other commands for setting attribute values (refer to "ahelp chips" for information on loading the module):

set_label_angle
set_label_color
set_label_depth
set_label_font
set_label_fontstyle
set_label_halign
set_label_size
set_label_valign

Examples

Example 1

chips> set_label(["color", "plum", "size", 16])

Using attribute/value pairs, set the label color to plum and font size to 16.

Example 2

chips> set_label({"color": "plum", "size": 16})

This is a repeat of the previous example, using a dictionary rather than a list to define the attributes to change.

Example 3

chips> set_label_text(r"\Gamma^\alpha = 2.3 \pm 0.4")

Change the text of the current label.

Example 4

chips> lbl = ChipsLabel()
chips> lbl.color = "blue"
chips> lbl.angle = 45
chips> lbl.font = "times"
chips> set_label("lbl1", lbl)

Populate the "lbl" structure with the attribute values, then use it to set lbl1 to have blue text in the Times font at a 45 degree angle.


Label Preferences and Attributes

The attributes associated with labels are given in the following table, where the "Set?" column refers to whether the attribute can be changed using the set_label() command. To change the label preference settings prepend "label." to the attribute name.

Attribute Description Options Default Set?
angle Angle, in degrees, at which the label is drawn -360.0 to 360.0 0.0 Yes
color Color of the text name or hex; see the Color section of "ahelp chipsopt" default Yes
coordsys coordinate system for the label PIXEL, WINDOW_NORM, FRAME_NORM, PLOT_NORM, DATA see "ahelp coordsys" No
depth Integer value indicating label depth see the Depth section of "ahelp chipsopt" default Yes
font text font helvetica|courier|times|greek; see the Font section of "ahelp chipsopt" helvetica Yes
fontstyle style of the label text normal|bold|italic|bolditalic; see the Font Style section of "ahelp chipsopt" normal Yes
halign Horizontal location of the string reference point of the label auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" left Yes
size Font size of the text 1 to 100 12 Yes
stem stem used for label id An alpha-numeric character sequence that does not contain a space lbl No
valign Vertical location of the string reference point of the label auto|base|center|left|right|top; see the Text Alignment section of "ahelp chipsopt" base Yes

Bugs

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

See Also

concepts
setget
labels
add_label, current_label, delete_label, display_label, get_label, hide_label, move_label, shuffle_label
utilities
load_font, set_current