Gauge size given a range or a JavaScript callback function.

gauge_size(g2, range = NULL, callback = NULL)

Arguments

g2

An object of class g2r as returned by g2r.

range

A vector indicating the minimum and maximum sizes.

callback

A JavaScript callback function (see cb) which returns a color.

Examples

func <- cb("function(dist){ if(dist > 60) return 20 return 5 }") g2(cars, asp(speed, dist, size = dist)) %>% fig_point() %>% gauge_size(callback = func)