Graphics Primitives for Text

With the (RefLink[Text, paclet:ref/Text]) graphics primitive, you can insert text at any position in two- or three-dimensional Wolfram Language graphics. Unless you explicitly specify a style or font using (RefLink[Style, paclet:ref/Style]), the text will be given in the graphic's base style.

Two-dimensional text.

This generates five pieces of text, and displays them in a plot:

Show[Graphics[Table[Text[Expand[(1+x)^n],{n,n}],{n,5}]],PlotRange->All]

Here is some vertically oriented text with its left-hand side at the point {2,2}:

Show[Graphics[Text[StyleForm["Some text",FontSize->14,FontWeight->"Bold"],{2,2},{-1,0},{0,1}]],Frame->True]

When you specify an offset for text, the relative coordinates that are used are taken to run from -1 to 1 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 -1 to 1.

Note that you can specify the color of a piece of text by preceding the (RefLink[Text, paclet:ref/Text]) graphics primitive with an appropriate (RefLink[RGBColor, paclet:ref/RGBColor]) or other graphics directive.

Three-dimensional text.

This puts text at the specified position in three dimensions:

Graphics3D[{PolyhedronData["Dodecahedron","GraphicsComplex"],Text["a point",{2,2,2},{1,1}]}]

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

Options for (RefLink[Text, paclet:ref/Text]).

By default, the text is just put straight on top of whatever graphics have already been drawn:

Graphics[{{GrayLevel[0.5],Rectangle[{0,0},{1,1}]},Text["Some text",{0.5,0.5}]}]

Now there is a rectangle with the background color of the whole plot enclosing the text:

Graphics[{{GrayLevel[0.5],Rectangle[{0,0},{1,1}]},Text["Some text",{0.5,0.5},Background->Automatic]}]