TEXT Function
Places text in the graph output. Associated variables
can control the color, size, font, base angle, and rotation of the
characters displayed. If you do not supply the (X1, Y1) coordinates,
the text is placed in the center of the graph.
Syntax
Required Variable
- LABEL= “text-string”
- specifies the text label. The text-string can
contain superscripts, subscripts, and Unicode characters by using
ODS escapement notation. Here is a simple example:
data anno;
input function $ label $7-40;
datalines;
text This label is rich(*ESC*){sup '2'}
;
run;
proc sgplot data=sashelp.class sganno=anno;
scatter x=weight y=height;
run;
Optional Variables
- ANCHOR= “TOPLEFT” | “TOP” |
“TOPRIGHT” | “RIGHT” | “BOTTOMRIGHT”
| “BOTTOM” | “BOTTOMLEFT” | “LEFT”
| “CENTER”
- specifies the anchor position of the annotation.
This point is placed on the specified X1 and Y1 positions.
- BORDER= “TRUE” | “FALSE”
- turns the border on and off.
- DISCRETEOFFSET= numeric-value
- specifies an amount to offset the annotation from
a discrete value in data space. Specify a value from
-0.5 (left offset) to +0.5 (right offset).
- DRAWSPACE= “draw-space-value”
- specifies the drawing space and units for the annotation. DRAWSPACE can be used
rather than specify X1SPACE and Y1SPACE individually.
draw-space-value can
be one of the following:
Default:GRAPHPERCENT (unless overridden by a coordinate draw
space, such as X1SPACE)
Restriction:For the SGPANEL and SGSCATTER procedures, only GRAPHPERCENT,
GRAPHPIXEL, LAYOUTPERCENT, and LAYOUTPIXEL values are valid.
- FILLCOLOR= “color” | “style-attribute”
- specifies the background color for the text annotation. You can specify a color
or a style element attribute. Here is an example of a style attribute:
GraphData2:Color
You
can specify colors using the same color schemes that are supported
by
SAS/GRAPH software.
For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:COLOR attribute in the graph’s current style
- FILLTRANSPARENCY= numeric-value
- specifies the transparency for the fill portion
of an annotation. Specify a value from
0.0 (completely opaque) to 1.0 (completely transparent).
- JUSTIFY= “CENTER” | “LEFT” |
“RIGHT”
- specifies the text justification.
- LAYER= “BACK” | “FRONT”
- specifies whether the annotation is drawn in front
of (FRONT) or behind (BACK) the graph.
- LINECOLOR= “color” | “style-attribute”
- specifies a line color for the border of the text
annotation. You can specify a color
or a style element attribute. Here is an example of a style attribute:
GraphData2:Color
You
can specify colors using the same color schemes that are supported
by
SAS/GRAPH software.
For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:COLOR attribute in the graph’s current style
Interaction:This option takes effect only if BORDER= “TRUE”.
- LINEPATTERN= “line-pattern”
- specifies a line pattern for the border of the text
annotation. You can reference SAS patterns by number or by name. For a list of line patterns,
see Line Patterns.
Default:LineStyle attribute in the graph’s current
style
Interaction:This option takes effect only if BORDER= “TRUE”.
- LINETHICKNESS= n
- specifies the line thickness of the border of the
text annotation. You cannot specify
the unit of measure. The default unit of pixels is always used.
Default:LineThickness attribute in the graph’s current
style
Interaction:This option takes effect only if BORDER= “TRUE”.
- ROTATE= degrees
- rotates the annotation. Specify a number between
0 and 360.
- TEXTCOLOR= “color” | “style-attribute”
- specifies the text color for the annotation. You can specify a color
or a style element attribute. Here is an example of a style attribute:
GraphData2:Color
You
can specify colors using the same color schemes that are supported
by
SAS/GRAPH software.
For more information, see Color-Naming Schemes in SAS/GRAPH: Reference.
Default:COLOR attribute of the GraphAnnoText style element
in the current style
- TEXTFONT= “font-family”
- specifies the font family for the annotation. The SAS ODS styles use TrueType system fonts. For more information,
see TrueType Fonts Supplied by SAS in SAS Language Reference: Concepts.
Default:FontFamily attribute of the GraphAnnoText style element
in the current style.
- TEXTSIZE= n <units>
- specifies the font size of the annotation. You can also specify
the unit of measurement. The default unit is pixels. For
a list of measurement units that are supported, see Units of Measurement.
Default:FontSize attribute of the GraphAnnoText style element
in the current style.
- TEXTSTYLE= “ITALIC” | “NORMAL”
- specifies whether the annotation characters are
italic (ITALIC) or normal (NORMAL).
Default:FontStyle attribute of the GraphAnnoText style element
in the current style.
- TEXTWEIGHT= BOLD | NORMAL
- specifies whether the annotation characters are
bold (BOLD) or normal (NORMAL).
Default:FontWeight attribute of the GraphAnnoText style element
in the current style.
- TRANSPARENCY= numeric-value
- specifies the degree of transparency for the annotation. Specify a value from
0.0 (completely opaque) to 1.0 (completely transparent).
- WIDTH= numeric-value
- specifies the width of the annotation. Specify a positive
number greater than zero. You can use the WIDTHUNIT variable to specify
the unit of measurement.
Default:Determined by the system
- WIDTHUNIT= “DATA” | “PERCENT”
| “PIXEL”
- specifies the dimension unit to use for the WIDTH
value.
- X1= numeric-value
- specifies the X coordinate of the annotation.
- X1SPACE= “draw-space-value”
- specifies the drawing space of the annotation’s
X coordinate.
draw-space-value can
be one of the following:
Default:GRAPHPERCENT
Restriction:For the SGPANEL and SGSCATTER procedures, only GRAPHPERCENT,
GRAPHPIXEL, LAYOUTPERCENT, and LAYOUTPIXEL values are valid.
- XAXIS= “X” | “X2”
- specifies which X axis to use for data space annotations.
- XC1= “text-string”
- specifies the character X coordinate of an annotation.
- Y1= numeric-value
- specifies the Y coordinate of the annotation.
- Y1SPACE= “draw-space-value”
- specifies the drawing space of the annotation’s
Y coordinate.
draw-space-value can
be one of the following:
Default:GRAPHPERCENT
Restriction:For the SGPANEL and SGSCATTER procedures, only GRAPHPERCENT,
GRAPHPIXEL, LAYOUTPERCENT, and LAYOUTPIXEL values are valid.
- YAXIS= “Y” | “Y2”
- specifies which Y axis to use for data space annotations.
- YC1= “text-string”
- specifies the character Y coordinate of an annotation.