Mathematica 9 is now available
Previous section-----Next section

2.10.13 Labeling Three-Dimensional Graphics

Mathematica provides various options for labeling three-dimensional graphics. Some of these options are directly analogous to those for two-dimensional graphics, discussed in Section 2.10.5. Others are different.

Boxed -> True draw a cuboidal bounding box around the graphics (default)
Axes -> True draw  ,  and  axes on the edges of the box (default for SurfaceGraphics)
Axes -> {False, False, True} draw the  axis only
FaceGrids -> All draw grid lines on the faces of the box
PlotLabel -> text give an overall label for the plot

Some options for labeling three-dimensional graphics.
This loads a package containing various polyhedra.

In[1]:=  <<Graphics`Polyhedra`

The default for Graphics3D is to include a box, but no other forms of labeling.

In[2]:=  Show[Graphics3D[Dodecahedron[ ]]]

Out[2]=

Setting Axes -> True adds  ,  and  axes.

In[3]:=  Show[%, Axes -> True]

Out[3]=

This adds grid lines to each face of the box.

In[4]:=  Show[%, FaceGrids -> All]

Out[4]=

BoxStyle -> style specify the style for the box
AxesStyle -> style specify the style for axes
AxesStyle -> {{xstyle}, {ystyle}, {zstyle}}
specify separate styles for each axis

Style options.
This makes the box dashed, and draws axes which are thicker than normal.

In[5]:=  Show[Graphics3D[Dodecahedron[ ]],
BoxStyle -> Dashing[{0.02, 0.02}],
Axes -> True, AxesStyle -> Thickness[0.01]]

Out[5]=

By setting the option Axes -> True, you tell Mathematica to draw axes on the edges of the three-dimensional box. However, for each axis, there are in principle four possible edges on which it can be drawn. The option AxesEdge allows you to specify on which edge to draw each of the axes.

AxesEdge -> Automatic use an internal algorithm to choose where to draw all axes
AxesEdge -> {xspec, yspec, zspec} give separate specifications for each of the  ,  and  axes
None do not draw this axis
Automatic decide automatically where to draw this axis
{ ,  } specify on which of the four possible edges to draw this axis

Specifying where to draw three-dimensional axes.
This draws the  on the edge with larger  and  coordinates, draws no  axis, and chooses automatically where to draw the  axis.

In[6]:=  Show[Graphics3D[Dodecahedron[ ]], Axes -> True,
AxesEdge -> {{1, 1}, None, Automatic}]

Out[6]=

When you draw the  axis on a three-dimensional box, there are four possible edges on which the axis can be drawn. These edges are distinguished by having larger or smaller  and  coordinates. When you use the specification { ,  } for where to draw the  axis, you can set the  to be +1 or -1 to represent larger or smaller values for the  and  coordinates.

AxesLabel -> None give no axis labels
AxesLabel -> zlabel put a label on the  axis
AxesLabel -> {xlabel, ylabel, zlabel} put labels on all three axes

Axis labels in three-dimensional graphics.
You can use AxesLabel to label edges of the box, without necessarily drawing scales on them.

In[7]:=  Show[Graphics3D[Dodecahedron[ ]], Axes -> True,
AxesLabel -> {"x", "y", "z"}, Ticks -> None]

Out[7]=

Ticks -> None draw no tick marks
Ticks -> Automatic place tick marks automatically
Ticks -> {xticks, yticks, zticks} tick mark specifications for each axis

Settings for the Ticks option.

You can give the same kind of tick mark specifications in three dimensions as were described for two-dimensional graphics in Section 2.10.5.

FaceGrids -> None draw no grid lines on faces
FaceGrids -> All draw grid lines on all faces
FaceGrids -> { ,  , ... } draw grid lines on the faces specified by the
FaceGrids -> {{ , { ,  }}, ... }
use  ,  to determine where and how to draw grid lines on each face

Drawing grid lines in three dimensions.

Mathematica allows you to draw grid lines on the faces of the box that surrounds a three-dimensional object. If you set FaceGrids -> All, grid lines are drawn in gray on every face. By setting FaceGrids -> { ,  , ... } you can tell Mathematica to draw grid lines only on specific faces. Each face is specified by a list { ,  ,  }, where two of the  must be 0, and the third one is +1 or -1. For each face, you can also explicitly tell Mathematica where and how to draw the grid lines, using the same kind of specifications as you give for the GridLines option in two-dimensional graphics.

This draws grid lines only on the top and bottom faces of the box.

In[8]:=  Show[Graphics3D[Dodecahedron[ ]],
FaceGrids -> {{0, 0, 1}, {0, 0, -1}}]

Out[8]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.