Learn R Programming

g2r (version 0.1.0)

gauge_size: Gauge size

Description

Gauge size given a range or a JavaScript callback function.

Usage

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

Run this code
# NOT RUN {
func <- cb("function(dist){
  if(dist > 60)
    return 20
  return 5
}")

g2(cars, asp(speed, dist, size = dist)) %>% 
  fig_point() %>% 
  gauge_size(callback = func)

# }

Run the code above in your browser using DataLab