drawLine: Draw a Line on the Page

Description Usage Arguments Value See Also Examples

Description

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

Figure: drawLine Example

Usage

1
2
3
4
5
drawLine(x, y, opacity = .pkgenv$lineOpacity, lineColor = .pkgenv$lineColor,
  lineWidth = .pkgenv$lineWidth, lineType = .pkgenv$lineType,
  arrowAngle = .pkgenv$arrowAngle, arrowLength = .pkgenv$arrowLength,
  arrowUnits = .pkgenv$arrowUnits, arrowEnds = .pkgenv$arrowEnds,
  arrowType = .pkgenv$arrowType, units = .pkgenv$units, ...)

Arguments

x

Numeric vector for the x-axis positions of the control points.

y

Numeric vector for the y-axis positions of the control points.

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).

arrowAngle

Numeric value of the angle for arrows. Smaller numbers create narrower arrows, and larger numbers produce wider arrows.

arrowLength

Numeric value of the length for arrows.

arrowUnits

Character value of the measurement unit for arrows.

arrowEnds

Character value indicating which end to draw arrows on lines. Must be one of "last", "first" or "both".

arrowType

Character value indicating if the arrow heads should be closed or open. Must be one of "open" or "closed".

units

Character value for the unit to use when specifying measurements.

...

Additional arguments passed to grid.lines.

Value

A grid.lines 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
23
24
25
26
27
28
29
library(draw)

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

# Create a new drawing page
drawPage()

# Draw a solid line
drawLine(x = c(1, 4),
         y = c(1 ,1))

# Draw a dashed line
drawLine(x = c(1, 4),
         y = c(2 ,2),
         lineType = "dashed")

# Draw a dotted line with ending arrow
drawLine(x = c(1, 4),
         y = c(3 ,3),
         lineType = "dotted", arrowEnds = "last")

# Draw thick two dash line with starting arrow
drawLine(x = c(1, 4),
         y = c(4, 4),
         lineWidth = 3, lineType = "twodash", arrowEnds = "first")

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

draw documentation built on May 2, 2019, 8:30 a.m.