View source: R/plot_text_calls.R
heading | R Documentation |
heading
plots 1 or more text strings (provided as a character vector labels
)
as a heading to an (existing or new) plot and places a colored box behind
each label to mark it (i.e., highlighting the heading).
heading(
labels,
x = 0,
y = 0.8,
x_layout = NA,
y_layout = "flush",
col = "black",
col_bg = "default",
cex = 2,
font = 2,
new_plot = "slide"
)
labels |
A character vector specifying the text labels to be plotted. |
x |
A numeric vector of x-coordinates at which the
text labels in |
y |
A numeric vector of y-coordinates at which the
text labels in |
x_layout |
An optional numeric vector or character string
to control the horizontal positions of |
y_layout |
A numeric value or character string
to control the vertical positions of |
col |
The color(s) of the text label(s).
Default: |
col_bg |
The color(s) to highlight or fill the rectangle(s) with.
Default: |
cex |
Numeric character expansion factor(s),
multiplied by |
font |
The font type(s) to be used.
Default: |
new_plot |
Boolean: Should a new plot be generated?
Set to |
Text formatting parameters (like col
, col_bg
, cex
, font
)
are recycled to match length(labels)
.
heading
uses the base graphics system graphics::
.
slide
and xbox
to create simple plots (without text).
heading(labels = c("This is a headline", "containing two lines."))
# Note the warning:
heading(labels = c("Headlines", "with 3 or more lines",
"should not be arranged", "in such a step-wise fashion."))
# Avoiding the warning:
heading(labels = c("Headlines with", "3 or more lines should",
"not be arranged", "in a step-wise fashion."))
# Using non-default colors:
heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."),
cex = 1.6, col = "white", col_bg = usecol(c(Pinky, Seegruen, Bordeaux, Karpfenblau)))
# Using x_layout and y_layout:
heading(labels = c("Ene,", "mene, miste,", "es rappelt", "in der Kiste."),
cex = 1.6, col = "white", col_bg = usecol(pal_pinky[2:5]),
x = NA, y = .6, x_layout = "right", y_layout = "flush")
#' @family text functions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.