Create a standalone map
Usage
driveplot_map(
shareddata,
lng = NULL,
lat = NULL,
colorvar = NULL,
label = NA,
colorpalette = NULL,
fillopacity = 1,
mapheight = "100vh"
)Arguments
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).
- 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
leaflet_color_palettes()to see the available options for viridis color palettes. Ifcolorvarandcolorpaletteare both not provided,colorpalettedefaults to blue. Ifcolorvaris provided butcolorpaletteis not,colorpalettedefaults 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".
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"
)