File: text_grob.Rd

package info (click to toggle)
r-cran-ggpubr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,240 kB
  • sloc: makefile: 2
file content (74 lines) | stat: -rw-r--r-- 2,168 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/text_grob.R
\name{text_grob}
\alias{text_grob}
\title{Create a Text Graphical object}
\usage{
text_grob(
  label,
  just = "centre",
  hjust = NULL,
  vjust = NULL,
  rot = 0,
  color = "black",
  face = "plain",
  size = NULL,
  lineheight = NULL,
  family = NULL,
  ...
)
}
\arguments{
\item{label}{A character or \link{expression} vector.  Other
    objects are coerced by \code{\link{as.graphicsAnnot}}.}

\item{just}{The justification of the 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: \code{"left"},
    \code{"right"}, \code{"centre"}, \code{"center"}, \code{"bottom"},
    and \code{"top"}.  For numeric values, 0 means left (bottom) alignment
    and 1 means right (top) alignment.
  }

\item{hjust}{A numeric vector specifying horizontal justification.
    If specified, overrides the \code{just} setting.}

\item{vjust}{A numeric vector specifying vertical justification.
    If specified, overrides the \code{just} setting.}

\item{rot}{The angle to rotate the text.}

\item{color}{text font color.}

\item{face}{font face. Allowed values include one of \code{"plain", "bold",
"italic", "bold.italic"}.}

\item{size}{font size (e.g.: size = 12)}

\item{lineheight}{line height (e.g.: lineheight = 2).}

\item{family}{font family.}

\item{...}{other arguments passed to \link[grid:grid.text]{textGrob}.}
}
\value{
a text grob.
}
\description{
Create easily a customized text grob (graphical object). Wrapper around
  \code{\link[grid:grid.text]{textGrob}}.
}
\examples{
text <- paste("iris data set gives the measurements in cm",
             "of the variables sepal length and width",
             "and petal length and width, respectively,",
             "for 50 flowers from each of 3 species of iris.",
             "The species are Iris setosa, versicolor, and virginica.", sep = "\n")

# Create a text grob
tgrob <- text_grob(text, face = "italic", color = "steelblue")
# Draw the text
as_ggplot(tgrob)

}