# 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[{x, y}, r]
draws a circle.
Disk[{x, y}, r]
draws a filled disk.
Rectangle[{x1, y1}, {x2, y2}]
draws a filled rectangle.
Polygon[{{x1, y1}, {x2, y2}, ...}]
draws a filled polygon.
Line[{{x1, y1}, {x2, y2}, ...}]
draws a line.
Text[text, {x, y}]
draws text in a graphics.

• Graphics[{Circle[{0, 0}, 1]}]

• Graphics[{Line[{{0, 0}, {0, 1}, {1, 1}, {1, -1}}], Rectangle[{0, 0}, {-1, -1}]}]

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

RGBColor[r, g, b]
specifies a color using red, green, and blue.
CMYKColor[c, m, y, k]
specifies a color using cyan, magenta, yellow, and black.
Hue[h, s, b]
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.

• Graphics[{Red, Disk[]}]

Table of hues:

• Graphics[Table[{Hue[h, s], Disk[{12h, 8s}]}, {h, 0, 1, 1/6}, {s, 0, 1, 1/4}]]

Colors can be mixed and altered using the following functions:

Blend[{color1, color2}, 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[{Lighter[Red], Disk[]}]

Graphics produces a GraphicsBox:

• Head[ToBoxes[Graphics[{Circle[]}]]]