Adds a label to a drawing area.
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)
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
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);
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.
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).
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.
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.
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.
- chips
-
chips_auto_redraw,
chips_clear,
chips_color_name,
chips_color_value,
chips_get_pane,
chips_get_xrange,
chips_get_xscale,
chips_get_yrange,
chips_get_yscale,
chips_get_zrange,
chips_get_zscale,
chips_line,
chips_pickpoints,
chips_redraw,
chips_set_pane,
chips_set_xrange,
chips_set_xscale,
chips_set_yrange,
chips_set_yscale,
chips_set_zrange,
chips_set_zscale,
chips_split,
chips_version
|