Customise aspects of the chart.

gauge_color(g, ...)

gauge_size(g, ...)

gauge_shape(g, ...)

gauge_tooltip(g, ...)

gauge_label(g, ...)

gauge_style(g, ...)

gauge_interplay(g, ...)

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

# 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))