
Last chance! 50% off unlimited learning
Sale ends in
Draws text on the page given positioning, dimensions and styling.
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, ...)
Numeric value for the x-axis position of the center.
Numeric value for the y-axis position of the center.
Character value of the text to display at xy position.
Character value of the text justification. One of "left", "right", "centre", "center", "bottom", or "top".
Numeric value of the horizontal justification.
Numeric value of the vertical justification.
Numeric value of the angle to rotate text.
Logical value indicating if overlapping text should be removed (TRUE) or not (FALSE).
Numeric value of the transparency for text ranging from 0 (transparent) to 1 (non-transparent).
Character value of the color for text.
Numeric value of the text font size in pt.
Character value of the text font face. One of "plain", "bold", "italic", "oblique", and "bold.italic" (see fontface in gpar).
Character value of text font family to use (see family in par). Common values are "serif", "sans" and "mono".
Numeric value of text line height as a multiple of the size of the text.
Character value for the unit to use when specifying measurements.
Additional arguments passed to grid.text.
# NOT RUN {
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")
# }
Run the code above in your browser using DataLab