Graphics

Two-dimensional graphics can be created using the function Graphics and a list of graphics primitives. For three-dimensional graphics see the following section. The following primitives are available:

Circle[{xy}, r]
draws a circle.
Disk[{xy}, r]
draws a filled disk.
Rectangle[{x1y1}, {x2y2}]
draws a filled rectangle.
Polygon[{{x1y1}, {x2y2}, ...}]
draws a filled polygon.
Line[{{x1y1}, {x2y2}, ...}]
draws a line.
Text[text, {xy}]
draws text in a graphics.

Colors can be added in the list of graphics primitives to change the drawing color. The following ways to specify colors are supported:

RGBColor[rgb]
specifies a color using red, green, and blue.
CMYKColor[cmyk]
specifies a color using cyan, magenta, yellow, and black.
Hue[hsb]
specifies a color using hue, saturation, and brightness.
GrayLevel[l]
specifies a color using a gray level.
All components range from 0 to 1. Each color function can be supplied with an additional argument specifying the desired opacity (“alpha”) of the color. There are many predefined colors, such as Black, White, Red, Green, Blue, etc.

Table of hues:

Colors can be mixed and altered using the following functions:

Blend[{color1color2}, ratio]
mixes color1 and color2 with ratio, where a ratio of 0 returns color1 and a ratio of 1 returns color2.
Lighter[color]
makes color lighter (mixes it with White).
Darker[color]
makes color darker (mixes it with Black).

Graphics produces a GraphicsBox: