Skip to contents

Make a single plotly scatter plot from shared drive data

Usage

driveplot_companion(
  shareddata,
  x,
  y,
  colorvar = NULL,
  colorpalette = "#03F",
  xlab = NULL,
  ylab = NULL,
  showlegend = TRUE,
  legendtitle = NULL
)

Arguments

shareddata

a SharedData object containing observations to be plotted

x

variable from shareddata to be plotted on the horizontal axis

y

variable from shareddata to be plotted on the vertical axis

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"

xlab

x-axis label

ylab

y-axis label

showlegend

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

legendtitle

the title for the plot legend

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)

# Time series of speed
driveplot_companion(nds_sf7_sd, time_cst, speed_mph)
# color points by direction of car driveplot_companion(nds_sf7_sd, time_cst, speed_mph, colorvar=gyro_heading, colorpalette="viridis")