Skip to contents

An interactive choropleth with hover and zoom, for dashboards and R Markdown / Quarto. Engines are all optional Suggests.

Usage

interactive_map(
  data,
  fill,
  tooltip = NULL,
  engine = c("plotly", "ggiraph", "leaflet", "ggsql"),
  ...
)

Arguments

data

A map-ready frame.

fill

The fill column (unquoted).

tooltip

Optional tooltip column (unquoted).

engine

"plotly" (default), "ggiraph", "leaflet" or "ggsql" (database-side rendering to a Vega-Lite widget; needs an sf frame).

...

Passed to world_map() for the plotly/ggiraph engines, or to world_query() for the "ggsql" engine.

Value

An interactive widget.

Examples

if (FALSE) { # \dontrun{
world_data(2020) |> interactive_map(gdp_per_capita)
world_data(2020, geometry = "sf") |>
  interactive_map(gdp_per_capita, engine = "ggsql", transform = "log10")
} # }