Description Usage Arguments Value See Also Examples
Draws a box on the page given positioning, dimensions and styling.
1 2 3 4 5 |
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. |
A grid.rect 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 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.