Learn R Programming

g2r (version 0.1.0)

info: Info

Description

Add informational elements to the chart.

Usage

info_line(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_vline(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_hline(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_text(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_image(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_region(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_html(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_arc(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_data_marker(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_region_filter(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

info_data_region(g2, ..., data = NULL, figures = NULL, inherit_asp = TRUE)

Arguments

g2

An object of class g2r as returned by g2r.

...

Info options and asp.

data

A data.frame containing data for asp if NULL is inherited from g2.

figures

Vector of names or indices of figure(s) to apply the information to, if NULL applies only to the first figure.

inherit_asp

Whether to inherit aspects from g2r.

Examples

Run this code
# NOT RUN {
g2(mtcars, asp(mpg, qsec)) %>% 
  fig_point() %>% 
  info_data_marker(
    content = "Marker",
    position = c(20, 20),
    inherit_asp = FALSE
  )

newcars <- cars[1:26,]
newcars$text <- LETTERS

g2(cars, asp(speed, dist)) %>% 
  fig_point() %>% 
  info_text(asp(speed, dist, content = text), data = newcars, offsetY = -20)
 
# }

Run the code above in your browser using DataLab