Description Usage Arguments Value See Also Examples
Draws a curve on the page given positioning, dimensions and styling.
1 2 3 4 5 6 7 8 9 10 | drawCurve(x, y, curvature = .pkgenv$curveCurvature,
angle = .pkgenv$curveAngle, points = .pkgenv$curvePoints,
shape = .pkgenv$curveShape, square = .pkgenv$curveSquare,
squareShape = .pkgenv$curveSquareShape, opacity = .pkgenv$curveOpacity,
lineColor = .pkgenv$curveLineColor, lineWidth = .pkgenv$curveLineWidth,
lineType = .pkgenv$curveLineType, inflect = .pkgenv$curveInflect,
open = .pkgenv$curveOpen, arrowAngle = .pkgenv$arrowAngle,
arrowLength = .pkgenv$arrowLength, arrowUnits = .pkgenv$arrowUnits,
arrowEnds = .pkgenv$arrowEnds, arrowType = .pkgenv$arrowType,
units = .pkgenv$units, ...)
|
x |
Numeric vector of length 2 for x-axis position of starting and ending points. |
y |
Numeric vector of length 2 for y-axis position of starting and ending points. |
curvature |
Numeric value for the curvature of the curve. Values of 0 create a straight line, negative values create left-hand curves, and positive values create right-hand curves. |
angle |
Numeric value of the curve control point skewness ranging from 0 to 180. Values less than 90 skew towards the start point, and values more than 90 skew towards the end point. |
points |
Numeric value for the number of curve control points with higher numbers creating a smoother curve. |
shape |
Numeric value for the shape of the curve ranging from -1 to 1 (See grid.xspline). |
square |
Logical value indicating whether curve control points are created in a city-block or oblique way. It is recommended to set this to TRUE if points is 1 and angle is 90, and FALSE otherwise (see grid.curve). |
squareShape |
Numeric value controlling curve behaviours relative to control points. Applies if square is TRUE. |
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). |
inflect |
Logical value indicating if the curve should be cut in half and inverted (TRUE) or not (FALSE). |
open |
Logical value indicating whether to open the curve (TRUE) or close the curve (FALSE). |
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.curve. |
A grid.curve grob object.
drawSettings
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 | library(draw)
# Set drawing settings
drawSettings(pageWidth = 5, pageHeight = 5, units = "inches")
# Create a new drawing page
drawPage()
# Draw a curved angle
drawCurve(x = c(1, 4),
y = c(1, 2),
angle = 90)
# Draw a curved angle with arrows
drawCurve(x = c(1, 4),
y = c(2, 3.75),
angle = 90, arrowLength = 0.1, arrowEnd = "both")
# Draw an inflected curve
drawCurve(x = c(1, 4),
y = c(3, 4),
angle = 90, inflect = TRUE)
# Export the drawing page to a PDF
drawExport("drawCurve.pdf")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.