Synopsis
Retrieves the attribute value(s) of the label.
Syntax
get_label() get_label(id) get_label(id, attribute)
Description
The function arguments.
Argument | Description |
---|---|
id | A ChipsId structure identifying the item, or a string containing the name of the object. |
attribute | The name of the attribute to retrieve, such as 'halign' or 'fontstyle'. |
The get_label command returns a structure containing all the attribute values of the label. To retrieve the value of a specific attribute, provide the attribute name and the id or ChipsId of the object.
Some values are set to "None" in the returned structure. These entries generally correspond to attributes which may only be modified at creation time, such as the object id.
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 get that value, use the get_label_text command.
To see if a label is hidden or visible, use the get_label_visible command.
Advanced Functions
The module of advanced ChIPS functions contains other commands for retrieving attribute values (refer to "ahelp chips" for information on loading the module):
get_label_angle get_label_color get_label_depth get_label_font get_label_fontstyle get_label_halign get_label_size get_label_valign
Examples
Example 1
chips> add_label(.4, .8, "C_6H_{12}O_6") chips> print(get_label()) chips> print(get_label("lbl1","font"))
A label is created and becomes current. Calling get_label with no argument returns all the attributes of the object. get_label is called a second time to return just the "font" attribute.
Example 2
chips> add_label(.4, .8, "C_6H_{12}O_6") chips> add_label(.4, .9, "x_1 * x_1 = x_1^2", "color=green") chips> print(get_label("lbl1"))
Two labels are created. get_label is called with the id of the first label, returning all attributes.
Example 3
chips> id=ChipsId() chips> id.label="lbl1" chips> print(get_label(id))
A ChipsId structure is created and the id.label field is set to "lbl1". get_label is called with the ChipsId.
Example 4
chips> lb = get_label() chips> print(lb)
Retrieve a structure containing the attribute values of the current label and store the results in "lb". Print the contents of "lb".
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, hide_label, move_label, set_label, shuffle_label
- utilities
- load_font, set_current