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 2006

URL: http://cxc.harvard.edu/ciao3.4/chips_label.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 chips_label Context: chips

Synopsis

Adds a label to a drawing area.

Syntax

Integer_Type chips_label(x,y,text)
Integer_Type chips_label(x,y,text,color)
Integer_Type chips_label(x,y,text,color,size)
Integer_Type chips_label(x,y,text,color,size,rotationAngle)

Description

This is a S-Lang version of the ChIPS LABEL command. It adds the text to the current pane at the specified location (x,y), and the optional parameters control the color, size, and rotation angle of the label.

Arguments for chips_label

Name Type Default Comment
x Numeric location of bottom left of text
y Numeric location of bottom left of text
text String_Type may contain TeX syntax
color Integer_Type _chips-> defcolor
size Numeric 1.0
rotationAngle Numeric 0 degrees

The rotationAngle parameter specifies the counter-clockwise rotation of the text from the horizontal. The rotation occurs about the point specified by the x and y parameters.

The function returns a 0 on success and -1 on failure. If used with the wrong number of arguments, it prints a usage message:

  chips> chips_label(1)
  Usage: chips_label(x,y,text[,color[,rotationAngle,[size]]])
  chips_label(1);

Quoting the text

Since the backslash character ('\') is used in S-Lang as a delimiter (as do printf and related functions in the C/C++ stdio library), remember to use a double backslash for embedded Tex commands or font specifications. For example,

  chips> chips_label(0.5,0.5,"\\it {HELLO}")

will draw the label "HELLO" in italic when SM is the underlying plot engine. Similarly, the command

  chips> chips_label(0.2,0.2,"\"myLabel\"")

ensures that the label will be enclosed by double quotes. Make sure that both sets of quotes are closed at the end.

Example 1

  chips> clear
  chips> chips_label(0.5,0.5,"A label")
  0
	

Here we mix ChIPS and S-Lang commands. The CLEAR command is used to remove any previous plots and set the axis limits to 0 and 1. Then we use the S-Lang command to add a label to the plot at (0.5,0.5).

Example 2

  chips> chips_label(0.7,0.7,"A label",_chips->red,2,180)
  0
	

This time the label is placed upside-down (i.e. rotated by 180), written in red, and has a size of 2.

Example 3

  chips_clear();
  () = chips_label(0.2,0.5, "x = \\frac{y+z/2}{y^{2}+3}");
	

This part of a S-lang script would clear the screen and then add the label to it. Note the use of a double backslash, as discussed in the "Quoting the text" section, above.

Example 4

  chips> () = chips_label(0.2,0.2,"\\oe This \\rm is \\gr Greek");
	

Here we use more TeX syntax in order to achieve mixed fonts in the same label. This command produces a label where the "This" text is in Old English font, the "is" text is in Roman font, and the "Greek" text is in the Greek font. See the ChIPS FONT command for more information on the available fonts.

Bugs

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

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



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.