driveplot_map: Create a standalone map

View source: R/driveplot_map.R

driveplot_mapR Documentation

Create a standalone map

Description

Create a standalone map

Usage

driveplot_map(
  shareddata,
  lng = NULL,
  lat = NULL,
  group = NULL,
  colorvar = NULL,
  label = NA,
  colorpalette = NULL,
  fillopacity = 1,
  mapheight = "100vh",
  tileprovider = "Esri.WorldStreetMap"
)

Arguments

shareddata

A SharedData object containing observations to be plotted.

lng

The bare (unquoted) column of shareddata containing longitude (only required if shareddata does not have a geometry column).

lat

The bare (unquoted) column of shareddata containing latitude (only required if shareddata does not have a geometry column).

group

The bare (unquoted) column from shareddata for the grouping variable.

colorvar

The bare (unquoted) column in shareddata to which color should be mapped.

label

An optional label for the map points.

colorpalette

The color palette for the plot; either a single color (e.g., "red") or one of the viridis color palettes compatible with leaflet. Run viridis_color_palettes() to see the available options for viridis color palettes. If colorvar and colorpalette are both not provided, colorpalette defaults to blue. If colorvar is provided but colorpalette is not, colorpalette defaults to the color palette "viridis".

fillopacity

The opacity of the fill of the map points (0 to 1).

mapheight

The height of the map, e.g, "100vh" or 400px".

tileprovider

The name of the provider for the basemap tiles. Options can be found by running leaflet::providers. Defaults to "Esri.WorldStreetMap".

Value

A leaflet map.

Examples

library(crosstalk)
data(drive7)
shared_drive <- SharedData$new(drive7)

# Basic map of one drive
driveplot_map(shareddata = shared_drive)

# Color drive points by direction of car
driveplot_map(
  shareddata = shared_drive,
  colorvar = gyro_heading,
  label = gyro_heading,
  colorpalette = "viridis"
)

DrivePlotR documentation built on Nov. 22, 2026, 5:06 p.m.