highlight_spec: Highlight Specification

Description Usage Arguments Details Value Author(s) Examples

View source: R/highlight.R

Description

Create a highlight specification to pass on to a chart function

Usage

1
highlight_spec(what, highlight_color = NULL, other_color = NULL)

Arguments

what

character The value(s) to highlight

highlight_color

character The highlight color(s)

other_color

character The color for the non-highlighted values

Details

highlight_color must be of length 1 or the same length as what. If it is of length 1 then all values in what are highlighted with the same color.

If highlight_color is NULL (the default) then it is set to the default color of the currently active ggcharts theme, i.e. ggcharts_get_default_color(ggcharts_get_theme()).

If other_color is NULL is is automatically determined from the background color of the currently active ggcharts theme.

Value

An object of class ggcharts_highlight_spec

Author(s)

Thomas Neitmann

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data("biomedicalrevenue")
revenue2018 <- biomedicalrevenue[biomedicalrevenue$year == 2018, ]

spec <- highlight_spec("Bayer")
bar_chart(revenue2018, company, revenue, highlight = spec)

spec <- highlight_spec("Bayer", "black", "gray")
bar_chart(revenue2018, company, revenue, highlight = spec)

spec <- highlight_spec(c("Bayer", "Novartis"))
bar_chart(revenue2018, company, revenue, highlight = spec)

spec <- highlight_spec(c("Bayer", "AstraZeneca"), c("darkgreen", "darkorange"))
bar_chart(revenue2018, company, revenue, highlight = spec)

ggcharts_set_theme("theme_ng")
spec <- highlight_spec("Novartis")
lollipop_chart(revenue2018, company, revenue, highlight = spec)

thomas-neitmann/ggcharts documentation built on Oct. 8, 2021, 1:17 a.m.