Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: 27 November 2012

How do I add or change a label in the plot? [Updated]


[Updated] (13 Dec 2012) The 'Annotate' menu of the GUI (also available by pressing the Right Mouse Button in a ChIPS window) allows you to add annotations, such as labels, directly from the GUI.

The add_label command is used to create a label and the set_label_text() command is used to change the text displayed by a label. In the example below we create a simple plot, add a label and then change its contents.

chips> clear()
chips> add_curve([1,2,3], [9,-2,45])
chips> add_label(1.5, 40, r"\alpha = 0.27 \pm 0.03")
chips> get_label_text()
       '\alpha = 0.27 \pm 0.03'
chips> set_label_text("alpha = 0.27 +/- 0.03")
chips> get_label_text()
       'alpha = 0.27 +/- 0.03'

When the label is initially created we use LaTeX-style notation, which means that we "protect" the string - by preceeding it with a r - to avoid the "\" being treated as an escape character. An alternative would be to write "\\" instead. When we change the label we switch to an ASCII-only display for the label text.

The ChIPS GUI

The ChIPS GUI makes it easy to modify a visualization using your mouse, rather than Pythoon functions. New in CIAO 4.5 is the ability to add annotations - such as labels, lines, points and regions - directly from the GUI.



Last modified: 27 November 2012
CXC logo

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-2012. All rights reserved.