Graphics primitives and directives

In Mathematica graphic primitives are nouns, and graphic directives are adjectives.  That is the the directives specify what the primitives look like.

The graphics primitives (2D) for use in Graphics[{__}] are
     Line, Point, Polygon, Text, Rectangle, Circle, Disk, Raster, RasterArray.

The graphics primitives (3D) for use in  Graphics3D[{__}] are
     Line, Point, Polygon, Text, Cuboid.
The directives available for specifying Graphics and Graphics3D primitives are:
    Thickness, PointSize, Dashing, AbsoluteThickness, AbsolutePointSize, AbsoluteDashing, RGBColor, Hue, GrayLevel, CMYKColor.

In addition the following directives are available for Graphics3D primitives:
    SurfaceColor, EdgeForm, FaceForm

The first argument in Graphics, or Graphics3D must be a suitable graphics primitive, or a list of such primatives. If a list of primitives is used, graphic directives can be included.  A graphics directive affects all relavent primitives that come after the directive until another directive is given to override the earlier directive.

For example in the next cell the first point, circle and line are drawn using the default directives.  The second circle and line are thicker due to the directive Thickness[0.02].  Also the second point is larger due to the directive PointSize[0.02]. The third point, circle and line are red due to the directive RGBColor[1,0,0] but the earlier directives for Thickness and PointSize still apply. Then for the fourth point, circle and line are green because the earlier color directive is overridden by the directive Hue[0.3]. In addition the directive AbsolutePointSize[20] makes the fourth point even larger than the points before it. However, the fourth circle and line are the same thickness as the third circle and line because there is no directive to override the earlier thickness. Finally the last circle and line are thinner due to the directive AbsoluteThickness[1], but they have the same color as the circle and line that preceeded them because the earlier directive wan not overridden.  Likewise the last point is the same size as the fourth point because there is no overridding directive.

RowBox[{RowBox[{example, =, RowBox[{Graphics, [, RowBox[{{, , RowBox[{RowBox[{Point, [ ... ], ,, Axes->True, ,, AspectRatioAutomatic, ,, ImageSize {600, 150}}], ]}], ;}]

Created by Mathematica  (May 16, 2004)

Back to Ted’s Tricks index page