The Graphical State

The graphical subsystem provides methods that draw lines, curves, markers, polygons, text, and other planar objects. You can draw these graphical objects in the plot background, in the plot foreground, or in the graph foreground. You can control the color of these objects, and you can set other graphical attributes such as the width and style of pens or the typeface and style of fonts. The collection of all these graphical characteristics is called the graphical state.

The drawing methods are composed of two types: those that alter or manipulate the graphical state, and those that draw using the current graphical state.

The graphical state consists of the following components:

The drawing region
There are three drawing regions: the plot background (underneath the Plot Area), the plot foreground (on top of the Plot Area), and the graph foreground (on top of the Graph Area). The default region is the plot foreground. The active drawing region is changed using DrawSetRegion.
The coordinate system
There are two types of coordinate systems: normalized coordinates, and data coordinates. For all plots, you can use a normalized coordinate system by specifying a minimum and maximum value for the X and Y directions. For plots that have exactly two interval numeric axes (e.g., histograms, contour plots, and scatter or line plots of interval variables), you can use the data coordinate system defined by the plot's data. The default coordinate system is normalized coordinates, and the default range is [0,100] for each axis. The coordinate system is changed using DrawUseDataCoordinates or DrawUseNormalizedCoordinates.
The brush
You can choose the color and style of the brush used to fill the interior of polygons and markers drawn by the drawing methods. The default brush is black and the default style is solid. The color of the brush is changed using DrawSetBrushColor. The style is changed using DrawSetBrushStyle.
The pen
You can choose the attributes of the pen used to draw lines, polygons, and the outline of markers drawn by the drawing methods. The default pen is black, has a width of one, and draws solid lines. The attributes of the pen are changed using DrawSetPenColor, DrawSetPenStyle, and DrawSetPenWidth.
The text attributes
You can choose the attributes of text drawn by the drawing methods. The default text is 9-point Arial and is drawn in black with a rotation angle of zero degrees. By default, text is centered in both the horizontal and vertical directions. The text attributes are changed using DrawSetTextAlignment, DrawSetTextAngle, DrawSetTextColor, DrawSetTextSize, DrawSetTextStyle, and DrawSetTextTypeface.

The graphical state can be saved with DrawPushState, reset with DrawResetState, and restored with DrawPopState. Automatic repainting of a plot can be controlled using DrawEnableAutoUpdate. All annotation commands (those methods beginning with "Draw") can be removed from a plot using the DrawRemoveCommands method.