add_label_image | R Documentation |
The function creates a tibble with the paths of the image labels to be plotted in a chronological chart or adds them to an already existing tibble.
add_label_image(
data,
region,
year,
position = 0.75,
image_path,
new = FALSE,
...
)
data |
An object to which labels should be added. Must not be provided
if |
region |
A character string or character vector with the titles of the sections the label(s) should be placed in. |
year |
A number or a numeric vector with the year(s) at which the label should be placed (i.e. its vertical position). |
position |
A number or a numeric vector with the horizontal position(s) of the label. See Details for explanation. |
image_path |
A character string or character vector with the file path(s) or URL(s) to the image files. |
new |
Logical operator. If |
... |
Further columns to include or additional arguments
passed to |
If the input is in the same order as the arguments, the arguments do not need to be explicitly named. Values can be provided as a number or character string, if they are the same for all other data. If not, they must be provided as vectors with equal lengths.
A tibble with image labels ready-to-use for plotting with
plot_chronochrt
.
# Create new label data set
labels <- add_label_image(region = "A",
year = -50,
position = 0.5,
image_path = "https://www.r-project.org/logo/Rlogo.png",
new = TRUE)
# Add labels to existing data set
labels <- add_label_image(data = labels,
region = "B",
year = 50,
position = 0.9,
image_path = "https://www.r-project.org/logo/Rlogo.png",
new = FALSE)
# They can be linked using the pipe operator \code{%>%}:
library(magrittr)
labels <- add_label_image(region = "A",
year = -50,
position = 0.5,
image_path = "https://www.r-project.org/logo/Rlogo.png",
new = TRUE) %>%
add_label_image(region = "B",
year = 50,
position = 0.9,
image_path = "https://www.r-project.org/logo/Rlogo.png")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.