highlight_spec {ggcharts} | R Documentation |
Highlight Specification
Description
Create a highlight specification to pass on to a chart function
Usage
highlight_spec(what, highlight_color = NULL, other_color = NULL)
Arguments
what |
|
highlight_color |
|
other_color |
|
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
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)
[Package ggcharts version 0.2.1 Index]