gaugeViews: Gauge Aspects

Description Usage Arguments See Also Examples

Description

Customise aspects of the chart.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

Arguments

g

An object of class g2r or g2Proxy as returned by g2() or g2_proxy().

...

Arguments to customise the gauge. Generally, key value pairs of options, a vector of hex colors, or a JavaScript function (wrapped in htmlwidgets::JS()).

See Also

gauge to gauge aspects of the grid and axis.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# base plot
g <- g2(cars, asp(speed, dist)) %>%
  fig_point(asp(color = speed))

# color with vector
g %>% gauge_color(c("red", "white", "blue"))

# color with callback
cb <- "function(speed){
 if(speed > 10){
   return 'blue';
 }
 return 'red';
}"

g %>% gauge_color(htmlwidgets::JS(cb))

devOpifex/g2r documentation built on Jan. 16, 2022, 12:36 a.m.