plotText | R Documentation |
Plot text within a plotgardener layout
plotText(
label,
fontcolor = "black",
fontsize = 12,
rot = 0,
check.overlap = FALSE,
x,
y,
just = "center",
default.units = "inches",
params = NULL,
...
)
label |
Character or expression of text to be plotted. |
fontcolor |
A character value specifying text fontcolor.
Default value is |
fontsize |
A numeric specifying text fontsize in points.
Default value is |
rot |
A numeric specifying the angle to rotate the text.
Default value is |
check.overlap |
A logical value to indicate whether to check
for and omit overlapping text.
Default value is |
x |
A numeric vector or unit object specifying text x-location. |
y |
A numeric vector, unit object, or a character vector of values containing a "b" combined with a numeric value specifying text y-locations. The character vector will place text y-locations relative to the bottom of the most recently plotted plot according to the units of the plotgardener page. |
just |
Justification of text relative to its (x, y) location.
If there are two values, the first value specifies horizontal
justification and the second value specifies vertical justification.
Possible string values are: |
default.units |
A string indicating the default units to use if
|
params |
An optional pgParams object containing relevant function parameters. |
... |
Additional grid graphical parameters. See gpar. |
Returns a text
object containing relevant
placement and grob information.
grid.text
## Create a page
pageCreate(width = 4, height = 2, default.units = "inches")
## Plot text, adjusting fontsize and fontface
plotText(
label = "plotgardener", fontsize = 14, fontface = "bold",
x = 1, y = 1, just = "center", default.units = "inches"
)
## Plot text, adjusting color, rotation, and fontfamily
plotText(
label = "coordinate-based", fontcolor = "#225EA8", rot = 90,
fontfamily = "HersheyScript", x = 2, y = 1, just = "center",
default.units = "inches"
)
## Plot a text label in multiple places at once
plotText(
label = "R", x = c(0.5, 1, 1.5), y = 1.5, just = "center",
default.units = "inches"
)
## Plot a vector of text labels
plotText(
label = c("pg", "plot", "gardener"), x = 3, y = c(0.5, 1, 1.75),
just = "center", default.units = "inches"
)
## Hide page guides
pageGuideHide()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.