Skip to contents

Make a stack of companion graphs from shared drive data

Usage

driveplot_companions(
  shareddata,
  time,
  y1,
  y2 = NULL,
  y3 = NULL,
  y4 = NULL,
  timelabel = NULL,
  y1label = NULL,
  y2label = NULL,
  y3label = NULL,
  y4label = NULL,
  colorvar = NULL,
  colorpalette = "#03F",
  showlegend = TRUE,
  legendtitle = NULL,
  spacing = 0.05,
  plotheight = "98vh"
)

Arguments

shareddata

a SharedData object containing observations to be plotted

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

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"

showlegend

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

legendtitle

the title for the plot legend

spacing

value between 0 and 1 for the space between the graphs

plotheight

the height of the stack of companion graphs in CSS units, e.g, "98vh"

Value

plotly scatterplot

Examples

library(crosstalk)
library(dplyr)
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)

# Linked time series of speed, headings (in GPS and gyro), and GPS quality
driveplot_companions(
     nds_sf7_sd, 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)",
     colorvar = gps_pdop, colorpalette = "viridis" )