Add points to a globe.

globe_choropleth(
  globe,
  ...,
  data = NULL,
  inherit_coords = TRUE,
  on_click = NULL,
  on_right_click = NULL,
  on_hover = NULL,
  match = c("auto", "iso2", "iso3", "name"),
  polygons = NULL
)

Arguments

globe

An object of class globe as returned by create_globe, or an object of class globeProxy as returned by globeProxy.

...

Coordinates, as specified by coords.

data

A data.frame of points to draw.

inherit_coords

Whether to inherit the coordinates (coords) from create_globe. Only applies to method applied to object of class globe4r not on objects of class globeProxy.

on_click

JavaScript functions as JS or TRUE to pick up the event from Shiny server side, see example.

on_right_click

JavaScript functions as JS or TRUE to pick up the event from Shiny server side, see example.

on_hover

JavaScript functions as JS or TRUE to pick up the event from Shiny server side, see example.

match

The type of country identifier, auto attempts to infer the type, iso2 (e.g.: "US"), iso3 (e.g.: "USA"), or the country name.

polygons

Polygons to match data against, if NULL is matched against internal dataset of world country polygons.

Details

By default the function will match the coords country argument against an internal dataset of country names, and iso codes. In order to use other polygons, one can pass GeoJSON as a list to the polygons argument and specify polygon argument in coords: this will match the latter against the data, see online documentation for a full example.

Coordinates

Valid coordinates.

  • country

  • polygon

  • altitude

  • label

  • side_color, cap_color

  • transition

Examples

create_globe() %>% globe_img_url() %>% globe_choropleth( data = agriland, coords(country = country_code, cap_color = percent) )