About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2007

URL: http://cxc.harvard.edu/chips4.0/add_label.py.html
AHELP for ChIPS 4.0 add_label Context: py.chips

Synopsis

Creates a label.

Syntax

add_label( [ChipsId,] xpos, ypos, text [,attributes])

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • xpos, ypos - the location of the label; the current coordinate system is used if one is not specified.
  • text - the text of the label. Basic Latex formatting is supported.
  • attributes - optional parameters which allow the user to configure properties though a structure, list, or attribute string.

The add_label command creates a label whose attributes are specified by user preferences or in an attribute list. The new label becomes current by default; providing a ChipsId overrides the currency state.

The position of the label is specified as a coordinate pair (xpos, ypos) in data, pixel, frame, or plot normalized coordinates. Labels specified in data coordinates will only be displayed if the are within the coordinate system range.

Alignment

Alignment attributes control how the text string is situated in relation to the reference position. Horizontal alignment can be specified as left (0), center (.5), right (1), or a numeric ratio of the text length. Vertical alignment is similarly controlled: bottom (0), center (.5), top (1), or a numeric ratio.

Customizing the Label

There are several attributes that control the label characteristics. The attributes can be set to the ChIPS defaults, values provided in the add_label command, or values from the user's preference file.

The attributes may also be modified with the set_label command at any time; see "ahelp py.chips set_label" and "ahelp py.chips setget" for more information.

The attributes associated with labels are:

Attribute Description Options Default
angle Angle at which the label is drawn -360.0:360.0 0.0
color Color of the text see the Color section of "ahelp py.chips chipsopt" default
depth Integer value indicating label depth see the Depth section of "ahelp py.chips chipsopt" 100
font text font see the Font section of "ahelp py.chips chipsopt" helvetica
fontstyle style of the label text see the Font Style section of "ahelp py.chips chipsopt" normal
halign Horizontal location of the string reference point of the label see the Text Alignment section of "ahelp py.chips chipsopt" left
size Font size of the text 1:100 12
stem stem used for label id alphanumeric lbl
valign Vertical location of the string reference point of the label see the Text Alignment section of "ahelp py.chips chipsopt" base

Example 1

chips> add_label(.4,.5,'area={\\pi}r^2')

Add a label at position (.4,.5). Latex formatting is used in the label text.

Example 2

chips> settings = ChipsLabel()
chips> settings.color = 'blue'
chips> settings.size = 8.0
chips> settings.stem = 'MyLabel'
chips> add_label(100,100,'Figure A',settings)

Populate the "settings" structure with the attribute values, then add the label "Figure A".

Example 3

chips> add_label(100,100,"Fig. B",['color', 'blue', 'size', 8])

Create a blue label, specifying the attribute values in a list.

Bugs

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

Last modified: December 2007



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