This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Graphics

Updated In 8 Graphic
Graphics
represents a two-dimensional graphical image.
  • The following graphics primitives can be used: »
Arrow[{{x1,y1},...}]arrow
BezierCurve[{pt1,pt2,...}]Bézier curve
BSplineCurve[{pt1,pt2,...}]B-spline curve
Circle[{x,y},r]circle
Disk[{x,y},r]filled disk
FilledCurve[{seg1,seg2,...}]filled curve
Inset[obj,...]inset object
GraphicsComplex[pts,prims]complex of graphics objects
GraphicsGroup[{g1,g2,...}]objects selectable as a group
JoinedCurve[{seg1,seg2,...}]joined curve segments
Line[{{x1,y1},...}]line
Locator[{x,y}]dynamic locator
Point[{x,y}]point
Polygon[{{x1,y1},...}]polygon
Raster[array]array of gray or colored squares
Rectangle[{xmin,ymin},{xmax,ymax}]rectangle
Text[expr,{x,y}]text
  • The following graphics directives can be used: »
AbsoluteDashing[{w1,...}]absolute line dashing specification
AbsolutePointSize[d]absolute point size specification
AbsoluteThickness[w]absolute line thickness specification
Arrowheads[specs]arrowheads specification
CapForm[type]line cap specification
CMYKColor[c,m,y,k]color specification
Dashing[{w1,...}]line dashing specification
Directive[g1,g2,...]composite graphics directive
EdgeForm[g]edge drawing specification
FaceForm[g]face drawing specification
GrayLevel[i]intensity specification
Hue[h]hue specification
JoinForm[type]line joining specification
Opacity[a]opacity specification
PointSize[d]point size specification
RGBColor[r,g,b]color specification
Texture[obj]texture specification
Thickness[w]line thickness specification
  • The following wrappers can be used at any level:
Annotation[obj,label]give an annotation
Button[obj,action]make obj act as a button
Dynamic[obj]use the dynamically updated current value
EventHandler[obj,...]attach an event handler
Hyperlink[obj,URI]make obj a hyperlink
Mouseover[obj,over]specify a mouseover form
PopupWindow[obj,cont]attach a popup window
StatusArea[obj,label]specify a label to appear in the status area
Style[obj,opts]specify a style
Tooltip[obj,label]attach a tooltip
  • The following options can be given:
AlignmentPointCenterthe default point in the graphic to align with
AspectRatioAutomaticratio of height to width
AxesFalsewhether to draw axes
AxesLabelNoneaxes labels
AxesOriginAutomaticwhere axes should cross
AxesStyle{}style specifications for the axes
BackgroundNonebackground color for the plot
BaselinePositionAutomatichow to align with a surrounding text baseline
BaseStyle{}base style specifications for the graphic
ContentSelectableAutomaticwhether to allow contents to be selected
CoordinatesToolOptionsAutomaticdetailed behavior of the coordinates tool
DisplayFunction$DisplayFunctionfunction for generating output
Epilog{}primitives rendered after the main plot
FormatTypeTraditionalFormthe default format type for text
FrameFalsewhether to put a frame around the plot
FrameLabelNoneframe labels
FrameStyle{}style specifications for the frame
FrameTicksAutomaticframe ticks
FrameTicksStyle{}style specifications for frame ticks
GridLinesNonegrid lines to draw
GridLinesStyle{}style specifications for grid lines
ImageMargins0.the margins to leave around the graphic
ImagePaddingAllwhat extra padding to allow for labels, etc.
ImageSizeAutomaticthe absolute size at which to render the graphic
LabelStyle{}style specifications for labels
MethodAutomaticdetails of graphics methods to use
PlotLabelNonean overall label for the plot
PlotRangeAllrange of values to include
PlotRangeClippingFalsewhether to clip at the plot range
PlotRangePaddingAutomatichow much to pad the range of values
PlotRegionAutomaticthe final display region to be filled
PreserveImageOptionsAutomaticwhether to preserve image options when displaying new versions of the same graphic
Prolog{}primitives rendered before the main plot
RotateLabelTruewhether to rotate y labels on the frame
TicksAutomaticaxes ticks
TicksStyle{}style specifications for axes ticks
  • Nested lists of graphics constructs can be given. Directive specifications such as GrayLevel normally remain in effect only until the end of the list that contains them. »
  • A list containing only graphics directives is treated as if its elements were directly inserted into an enclosing list.
  • Style can be used to apply the options or directives opts to obj. »
  • The settings for BaseStyle are appended to the default style typically given by the style in the current stylesheet. The settings for AxesStyle, LabelStyle, etc. are appended to the default styles given for , , etc.
  • Graphics gives an empty graphic with the default image size.
Use lines, polygons, circles, etc. to build up a graphics image:
Use plot functions to automatically create Graphics from different types of data:
Use lines, polygons, circles, etc. to build up a graphics image:
In[1]:=
Click for copyable input
Out[1]=
 
Use plot functions to automatically create Graphics from different types of data:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
Graphics primitives are drawn in the order in which they are given in Graphics:
Polygons can fold over themselves:
Vertices can be shared by using GraphicsComplex:
Inset an expression in a graphic:
Directives can specify color and opacity of faces:
Colors, thickness, and dashing directives affect lines, arrows, and edges:
Some primitives have special directives to specify various properties:
Directives can be applied to individual objects using Style:
Graphics directives normally remain in effect only until the end of the list that contains them:
Use an ordinary coordinate system:
Specify coordinates by fractions of the plot range:
Specify coordinates by fractions of the whole image:
Offset coordinates by printer's points:
Specify the coordinates within Inset to be aligned with the center of the enclosing graphic:
Use numerical values for AspectRatio:
Draw all the axes:
Draw the axis but not the axis:
Place a label for the axis:
Specify a label for each axis:
Determine where the axes cross automatically:
Specify the axes' origin explicitly:
Specify the overall axes style, including the ticks and the tick labels:
Specify the style of each axis:
Specify a background color:
Align the center of a graphic with the baseline of the text:
Specify the baseline of a graphic as a fraction of the height by using Scaled:
Use the axis of a graphic as the baseline:
Set the starting style:
Set multiple starting styles:
Allow the individual graphics objects to be selectable by a single click:
No individual object is selectable; the whole graphic appears as one object:
The first click selects the whole graphic, and subsequent ones select individual objects:
Display a graphic in PopupWindow when clicked:
Display a graphic in a new notebook:
Draw a disk above the graphic, including the axes:
By default, expressions are displayed using TraditionalForm in graphics:
Display expressions using StandardForm:
Labels are also affected by FormatType setting:
Draw a frame around the whole graphic:
Draw a frame on the left and the right edges:
Specify frame labels for the bottom and the left edges:
Specify labels for each edge:
Specify the overall frame style:
Specify the style of each frame edge:
Put a frame, but no ticks:
Tick mark labels on the bottom and the left frame edges:
Frame ticks on the bottom and the right edges:
Specify frame tick and frame tick label style:
Specify frame ticks style for each edge:
Put grids across a 2D graphic:
Draw grid lines at specific positions:
Specify the style of each grid:
Specify the overall grid style:
Allow no margins outside of ImageSize:
Have 20-point margins on all sides:
Leave different margins on each side:
Leave no padding outside of the plot range:
Leave enough padding for all objects and labels that are present:
Specify the same padding for all sides in printer's points:
Specify different padding on each side:
Use predefined symbolic sizes:
Use an explicit image width:
Use an explicit image width and height:
Specify the overall style of all the label-like elements:
Display a label on the top of the graphic in TraditionalForm:
Use Style and other typesetting functions to modify how the label appears:
Display all objects:
Explicitly choose and ranges:
Force clipping at the PlotRange:
PlotRange->s is equivalent to PlotRange:
Allow graphics objects to spread beyond PlotRange:
Clip all graphics objects at PlotRange:
Include coordinate unit of padding on all sides:
Include padding using Scaled coordinates:
Specify different padding on each side:
The contents of a graphic use the whole region:
Limit the contents of the graphic to the middle half of the region in each direction:
ImagePadding can also be used to add padding around a graphic:
Define a simple graphic to use as background:
Use it in multiple graphics:
Specify that vertical frame labels should be rotated:
Specify that vertical frame labels should not be rotated:
Draw the axes but no tick marks:
Place tick marks automatically:
Draw tick marks at the specific positions:
Specify the styles of the ticks and tick labels:
Specify the styles of and axis ticks separately:
Draw a complete graph with 9 vertices:
The StandardForm of Graphics is its rendered form:
The InputForm is the textual expression form:
Graphics can be used as input to functions:
2D plot functions return Graphics:
Several integrated data sources return Graphics:
Many Import and Export formats support Graphics:
Display an analog clock with current system time:
Digital dahlias:
New in 1 | Last modified in 8