drawBox: Draw a Box on the Page

Description Usage Arguments Value See Also Examples

Description

Draws a box on the page given positioning, dimensions and styling.

Figure: drawBox Example

Usage

1
2
3
4
5
drawBox(x, y, width = .pkgenv$boxWidth, height = .pkgenv$boxHeight,
  radius = .pkgenv$boxRadius, fillColor = .pkgenv$boxFillColor,
  opacity = .pkgenv$boxOpacity, lineColor = .pkgenv$boxLineColor,
  lineWidth = .pkgenv$boxLineWidth, lineType = .pkgenv$boxLineType,
  units = .pkgenv$units, ...)

Arguments

x

Numeric value for the x-axis position of the center.

y

Numeric value for the y-axis position of the center.

width

Numeric value for the width.

height

Numeric value for the height.

radius

Numeric value for the radius to create rounded box corners.

fillColor

Character value for the fill color.

opacity

Numeric value for the transparency with values ranging from 0 (transparent) to 1 (non-transparent).

lineColor

Character value for the color of the lines.

lineWidth

Numeric value for the width of the lines.

lineType

Character value for the line type. One of "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash" (see "lty" in par).

units

Character value for the unit to use when specifying measurements.

...

Additional arguments passed to grid.rect.

Value

A grid.rect grob object.

See Also

drawSettings

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(draw)

# Set drawing settings
drawSettings(pageWidth = 5, pageHeight = 5, units = "inches")

# Create a new drawing page
drawPage()

# Draw a square
drawBox(x = 1, y = 4, width = 1, height = 1)

# Draw a square with rounded corners
drawBox(x = 4, y = 4, width = 1, height = 1, radius = 0.25)

# Draw a rectangle
drawBox(x = 1, y = 1, width = 1, height = 0.5)

# Draw a rectangle with rounded corners
drawBox(x = 4, y = 1, width = 1, height = 0.5, radius = 0.25)

# Export the drawing page to a PDF
drawExport("drawBox.pdf")

rrwen/draw documentation built on May 10, 2019, 1:52 a.m.