Graphics Primitives for Text

With the Text graphics primitive, you can insert text at any position in two or threedimensional Wolfram Language graphics. Unless you explicitly specify a style or font using Style, the text will be given in the graphic's base style.

Text[expr,{x,y}]text centered at the point {x,y}
Text[expr,{x,y},{-1,0}]text with its lefthand end at {x,y}
Text[expr,{x,y},{1,0}]righthand end at {x,y}
Text[expr,{x,y},{0,-1}]centered above {x,y}
Text[expr,{x,y},{0,1}]centered below {x,y}
Text[expr,{x,y},{dx,dy}]text positioned so that {x,y} is at relative coordinates {dx,dy} within the box that bounds the text
Text[expr,{x,y},{dx,dy},{0,1}]text oriented vertically to read from bottom to top
Text[expr,{x,y},{dx,dy},{0,-1}]text that reads from top to bottom
Text[expr,{x,y},{dx,dy},{-1,0}]text that is upsidedown

Twodimensional text.

This generates five pieces of text, and displays them in a plot.
Click for copyable input
Here is some vertically oriented text with its lefthand side at the point {2,2}.
Click for copyable input

When you specify an offset for text, the relative coordinates that are used are taken to run from to in each direction across the box that bounds the text. The point {0,0} in this coordinate system is defined to be center of the text. Note that the offsets you specify need not lie in the range to .

Note that you can specify the color of a piece of text by preceding the Text graphics primitive with an appropriate RGBColor or other graphics directive.

Text[expr,{x,y,z}]text centered at the point {x,y,z}
Text[expr,{x,y,z},{sdx,sdy}]text with a twodimensional offset

Threedimensional text.

This puts text at the specified position in three dimensions.
Click for copyable input

Note that when you use text in threedimensional graphics, the Wolfram Language assumes that the text is never hidden by any polygons or other objects.

option name
default value
BackgroundNonebackground color
BaseStyle{}style or font specification
FormatTypeStandardFormformat type

Options for Text.

By default, the text is just put straight on top of whatever graphics have already been drawn.
Click for copyable input
Now there is a rectangle with the background color of the whole plot enclosing the text.
Click for copyable input

Related Tutorials