dynTextGrob | R Documentation |
This function creates a text object. When drawn, its size changes automatically according to the space available.
dynTextGrob(label, x = 0.5, y = 0.5, width = 1, height = 1,
default.units = "npc", just = c(0.5, 0.5),
hjust = NULL, vjust = NULL, rot = 0, rotJust = TRUE,
rotHjust = NULL, rotVjust = NULL, resize = TRUE,
sizingWidth = NULL, sizingHeight = NULL,
adjustJust = TRUE, takeMeasurements = FALSE,
name = NULL, gp = gpar(), vp = NULL)
label |
a |
x |
a |
y |
a |
width |
the space available for the labels in the width direction of the viewport. Used for computing the fontsize. |
height |
the space available for the labels in the height direction of the viewport. Used for computing the fontsize. |
default.units |
default unit to use when dimensions or locations
are unitless numbers. See |
just |
a |
hjust |
a |
vjust |
a |
rot |
a |
rotJust |
a |
rotHjust |
a |
rotVjust |
a |
resize |
a |
sizingWidth |
If |
sizingHeight |
See |
adjustJust |
A |
takeMeasurements |
A |
name |
a |
gp |
graphical parameters. See |
vp |
a |
The number of labels created is the maximum of the lengths of x
and y
. Variables are recycled to that length if necessary.
All labels of one "dynText"
grob have the same fontsize.
If takeMeasurements
is FALSE
(the default), returns a
grob
of class
"dynText"
. It can be drawn
with grid.draw
.
If takeMeasurements
is TRUE
, returns a list
containing measurements of the labels.
Mikko Korpela
See function textGrob
in package
grid.
library(grid)
grid.newpage()
grid.draw(dynTextGrob("Hello", vjust = 0, y = 0))
grid.draw(dynTextGrob(list(expression(y==x^2),
"Hello,\ntry resizing me!"),
x = rep(1, 2), y = 1, rot = -45,
hjust = 1, vjust = 1,
rotHjust = c(0, 1), rotVjust = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.