Description Usage Arguments Value See Also Examples
Draws text on the page given positioning, dimensions and styling.
1 2 3 4 5 6 7 | drawText(x, y, text = .pkgenv$text, just = .pkgenv$textJust,
hjust = .pkgenv$textHjust, vjust = .pkgenv$textVjust,
angle = .pkgenv$textAngle, overlap = .pkgenv$textOverlap,
opacity = .pkgenv$textOpacity, color = .pkgenv$textColor,
size = .pkgenv$textSize, face = .pkgenv$textFace,
family = .pkgenv$textFamily, lineHeight = .pkgenv$textLineHeight,
units = .pkgenv$units, ...)
|
x |
Numeric value for the x-axis position of the center. |
y |
Numeric value for the y-axis position of the center. |
text |
Character value of the text to display at xy position. |
just |
Character value of the text justification. One of "left", "right", "centre", "center", "bottom", or "top". |
hjust |
Numeric value of the horizontal justification. |
vjust |
Numeric value of the vertical justification. |
angle |
Numeric value of the angle to rotate text. |
overlap |
Logical value indicating if overlapping text should be removed (TRUE) or not (FALSE). |
opacity |
Numeric value of the transparency for text ranging from 0 (transparent) to 1 (non-transparent). |
color |
Character value of the color for text. |
size |
Numeric value of the text font size in pt. |
face |
Character value of the text font face. One of "plain", "bold", "italic", "oblique", and "bold.italic" (see fontface in gpar). |
family |
Character value of text font family to use (see family in par). Common values are "serif", "sans" and "mono". |
lineHeight |
Numeric value of text line height as a multiple of the size of the text. |
units |
Character value for the unit to use when specifying measurements. |
... |
Additional arguments passed to grid.text. |
A grid.text 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 text on top left corner
drawText(x = 1, y = 4, text = "Top Left")
# Draw bold text on top right corner
drawText(x = 4, y = 4, text = "Top Right", face = "bold")
# Draw serif text on bottom left corner
drawText(x = 1, y = 1, text = "Bottom Left", family = "serif")
# Draw larger text on bottom right corner
drawText(x = 4, y = 1, text = "Bottom Right", size = 14)
# Export the drawing page to a PDF
drawExport("drawText.pdf")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.