Skip to contents

Make a stack of companion graphs from shared drive data

Usage

driveplot(
  shareddata,
  lng = NULL,
  lat = NULL,
  maplabel = NA,
  colorvar = NULL,
  colorpalette = "#03F",
  fillOpacity = 1,
  time,
  y1,
  y2 = NULL,
  y3 = NULL,
  y4 = NULL,
  timelabel = NULL,
  y1label = NULL,
  y2label = NULL,
  y3label = NULL,
  y4label = NULL,
  showlegend = TRUE,
  legendtitle = NULL,
  plottitle = NULL,
  spacing = 0.05
)

Arguments

shareddata

a SharedData object containing observations to be plotted

lng

the column of shareddata containing longitude (only required if shareddata does not have a geometry column)

lat

the column of shareddata containing latitude (only required if shareddata does not have a geometry column)

maplabel

an optional label for the map points

colorvar

the variable in shareddata to which color should be mapped

colorpalette

either a single color (e.g., "red") or one of "viridis", "inferno", "magma", or "plasma"

fillOpacity

the opacity of the fill (0 to 1)

time

time variable from shareddata to be plotted on the horizontal axis

y1

variable from shareddata to be plotted on the vertical axis for the first graph

y2

variable from shareddata to be plotted on the vertical axis for the second graph

y3

variable from shareddata to be plotted on the vertical axis for the third graph

y4

variable from shareddata to be plotted on the vertical axis for the fourth graph

timelabel

the label for the time variable on the horizontal axis

y1label

the label for the variable on the vertical axis for the first graph

y2label

the label for the variable on the vertical axis for the second graph

y3label

the label for the variable on the vertical axis for the third graph

y4label

the label for the variable on the vertical axis for the fourth graph

showlegend

show the plot legend (TRUE) or not (FALSE)

legendtitle

the title for the plot legend

plottitle

the title for the plot map

spacing

value between 0 and 1 for the space between the graphs

Value

linked plot map

Examples

# example code
library(crosstalk)
library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
data(nds_data)
nds_sf7 <- nds_data %>%
  filter(drive==7) %>%
  sf::st_as_sf(coords = c("gps_long", "gps_lat"), crs = "WGS84")
nds_sf7_sd <- SharedData$new(nds_sf7)

driveplot(nds_sf7_sd, #lng = gps_long, lat = gps_lat,
     colorvar=gyro_heading, colorpalette="viridis",
     time = time_cst, timelabel="Time",
     y1 = speed_mph, y1label = "Speed (mph)",
     y2 = gyro_heading, y2label = "Gyro Heading (degree)",
     y3 = gps_heading, y3label = "GPS Heading (degree)")