| Title: | Linked Plot Maps for Multivariate High-Resolution Spatio-Temporal Data |
|---|---|
| Description: | Create interactive, linked plot maps for multivariate high-resolution spatio-temporal data, such as vehicle trajectories. You can explore the spatial, temporal, and multivariate aspects of the data simultaneously. |
| Authors: | Marie Hardt [aut, cre, cph] (ORCID: <https://orcid.org/0009-0001-8548-9866>), Heike Hofmann [ctb] (ORCID: <https://orcid.org/0000-0001-6216-5183>), Guillermo Basulto-Elias [ctb] (ORCID: <https://orcid.org/0000-0002-5205-2190>) |
| Maintainer: | Marie Hardt <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.9000 |
| Built: | 2026-06-10 15:10:00 UTC |
| Source: | https://github.com/hardtme/driveplotr |
This dataset contains drive 7 from the dataset nds_data.
drive7drive7
A tibble with 321 rows and 34 columns
integer, identifier for a drive; a drive is defined as the time between starting the car and turning it off again.
POSIXct time stamp for each observation in UTC
POSIXct time stamp for each observation in Central time
GPS-based measurements for each observation:
numeric, elevation above sea-level (in m)
numeric, continuity-corrected direction of the car (in degrees with north at 0 degrees and increasing clockwise) as measured by GPS. The continuity correction takes the initial GPS heading and adds the cumulative sum of the changes in GPS heading for the subsequent observations.
numeric, value specifying the adequacy of the GPS fix, where 0 = no fix, 1 = time only, 2 = 2D fix, 3 = 3D fix. A gps_fix of 3 is needed for good GPS data.
integer, the number of satellites covering a position.
numeric, position dilution of precision, an overall GPS data quality measure (lower is better)
numeric, horizontal dilution of precision, a GPS quality measure for latitude/longitude data (lower is better)
numeric, vertical dilution of precision, a GPS quality measure for elevation data (lower is better)
numeric, speed of the vehicle (in miles per hour)
character, the source of the reported speed, either "gps" or "obd"
numeric, distance traveled during a drive (in miles)
Measurements by the on-board gyroscope:
numeric, measure of vehicle acceleration along the front-back (longitudinal) axis (in g)
numeric, measure of vehicle acceleration along the right-left (lateral) axis (in g)
numeric, measure of acceleration of the vehicle in the up-down plane (normal/yaw axis) (in g)
numeric, sequential (over time) variable marking when consecutive acceleration values (absolute value of accel_x/y) exceed a threshold of 0.35g for a minimum of 1 second
character, severity categorization of acceleration event into low (0.35-0.44g), medium (0.45-0.59g), and high (>0.6g)
numeric, angular rotation rate about the right-to-left axis (in degrees/sec)
numeric, angular rotation rate about the forward-to-backward axis (in degrees/sec)
numeric, angular rotation rate about the up-to-down axis (in degrees/sec)
numeric, calculated heading utilizing compass data and gyro data (in degrees with north at 0 degrees and increasing clockwise). Note that we use non-standard congruence classes for continuity of consecutive values. Due to errors in the raw gyro heading, we use the initial GPS heading value as the initial heading value and then subtract the cumulative sum of gyro_z for the subsequent observations to calculate gyro_heading.
numeric, lateral gravity (in g)
numeric, longitudinal gravity (in g)
numeric, gravity (up-down) (in g)
numeric, angle about the forward-to-backward axis. 0 = level, positive = tilted to the left (in degrees)
numeric, angle about the left-to-right axis where 0 = level, positive = tilted downward (i.e., vehicle going downhill) (in degrees)
numeric, current engine revolutions per minute value
numeric, engine throttle as a percentage (0-100%)
numeric, the cumulative distance driven in miles at each observation
factor, the minute component of the timestamp for each observation (00 to 59)
Raw heading measurements:
numeric, raw GPS heading without continuity correction (in degrees)
numeric, raw gyro heading without continuity correction (in degrees)
GPS coordinates in a simple features column:
list-column, simple features geometry column with geometry type POINT and CRS WGS84
Create a vehicle trajectory plot map
driveplot( shareddata, lng = NULL, lat = NULL, x, ys, colorvar = NULL, maplabel = NA, colorpalette = NULL, fillopacity = 1, xlabel = NULL, ylabels = NULL, showlegend = TRUE, legendtitle = NULL, plottitle = NULL, spacing = 0.05, width = "100%", height = "100vh" )driveplot( shareddata, lng = NULL, lat = NULL, x, ys, colorvar = NULL, maplabel = NA, colorpalette = NULL, fillopacity = 1, xlabel = NULL, ylabels = NULL, showlegend = TRUE, legendtitle = NULL, plottitle = NULL, spacing = 0.05, width = "100%", height = "100vh" )
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) |
x |
The bare (unquoted) column from shareddata to be plotted on the horizontal axis. |
ys |
A vector or list of bare (unquoted) columns from shareddata to be plotted on the vertical axes of the companion graphs. |
colorvar |
The bare (unquoted) column in shareddata to which color should be mapped. |
maplabel |
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 |
fillopacity |
The opacity of the fill of the map points (0 to 1). |
xlabel |
The label for the variable on the horizontal axis. |
ylabels |
A vector or list of labels for the vertical axes of the companion graphs. If provided, it should be the same length as ys. |
showlegend |
Show the plot legend (TRUE) or not (FALSE). |
legendtitle |
The title for the plot legend. |
plottitle |
The title for the plot map. |
spacing |
A value between 0 and 1 for the space between the companion graphs. |
width |
The width of the plot map, provided as a string with one of the following units: %, vh, vw, or px (e.g., "100%" or "400px") |
height |
The height of the plot map, provided as a string with one of the following units: %, vh, vw, or px (e.g., "100%" or "400px") |
A linked plot map.
library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) driveplot( shareddata = shared_drive, x = time_cst, ys = c(speed_mph, gyro_heading, gps_heading), colorvar = gyro_heading, maplabel = time_cst, colorpalette = "viridis", fillopacity = 1, xlabel = "Time", ylabels = c( "Speed (mph)", "Gyro Heading (degrees)", "GPS Heading (degrees)" ), showlegend = TRUE, legendtitle = "Gyro Heading", plottitle = "A drive with points colored by gyro heading", height = "500px" )library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) driveplot( shareddata = shared_drive, x = time_cst, ys = c(speed_mph, gyro_heading, gps_heading), colorvar = gyro_heading, maplabel = time_cst, colorpalette = "viridis", fillopacity = 1, xlabel = "Time", ylabels = c( "Speed (mph)", "Gyro Heading (degrees)", "GPS Heading (degrees)" ), showlegend = TRUE, legendtitle = "Gyro Heading", plottitle = "A drive with points colored by gyro heading", height = "500px" )
Make a single plotly scatter plot from shared drive data
driveplot_companion( shareddata, x, y, colorvar = NULL, colorpalette = NULL, xlabel = NULL, ylabel = NULL, showlegend = TRUE, legendtitle = NULL )driveplot_companion( shareddata, x, y, colorvar = NULL, colorpalette = NULL, xlabel = NULL, ylabel = NULL, showlegend = TRUE, legendtitle = NULL )
shareddata |
A SharedData object containing observations to be plotted. |
x |
The bare (unquoted) column from shareddata to be plotted on the horizontal axis. |
y |
The bare (unquoted) column from shareddata to be plotted on the vertical axis. |
colorvar |
The bare (unquoted) column in shareddata to which color should be mapped. |
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 |
xlabel |
The label for the variable on the horizontal axis. |
ylabel |
The label for the variable on the vertical axis. |
showlegend |
Show the plot legend (TRUE) or not (FALSE). |
legendtitle |
The title for the plot legend. |
A plotly scatterplot.
library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) # Time series of speed driveplot_companion( shareddata = shared_drive, x = time_cst, y = speed_mph ) # Color points by direction of car driveplot_companion( shareddata = shared_drive, x = time_cst, y = speed_mph, colorvar = gyro_heading, colorpalette = "viridis", xlabel = "Time", ylabel = "Speed (MPH)", showlegend = TRUE, legendtitle = "Gyro Heading" )library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) # Time series of speed driveplot_companion( shareddata = shared_drive, x = time_cst, y = speed_mph ) # Color points by direction of car driveplot_companion( shareddata = shared_drive, x = time_cst, y = speed_mph, colorvar = gyro_heading, colorpalette = "viridis", xlabel = "Time", ylabel = "Speed (MPH)", showlegend = TRUE, legendtitle = "Gyro Heading" )
Make a stack of companion graphs from shared drive data
driveplot_companions( shareddata, x, ys, colorvar = NULL, xlabel = NULL, ylabels = NULL, colorpalette = NULL, showlegend = TRUE, legendtitle = NULL, spacing = 0.05, plotheight = "100vh" )driveplot_companions( shareddata, x, ys, colorvar = NULL, xlabel = NULL, ylabels = NULL, colorpalette = NULL, showlegend = TRUE, legendtitle = NULL, spacing = 0.05, plotheight = "100vh" )
shareddata |
A SharedData object containing observations to be plotted. |
x |
The bare (unquoted) column from shareddata to be plotted on the horizontal axis. |
ys |
A vector or list of bare (unquoted) columns from shareddata to be plotted on the vertical axes of the companion graphs. |
colorvar |
The bare (unquoted) column in shareddata to which color should be mapped. |
xlabel |
The label for the variable on the horizontal axis. |
ylabels |
A vector or list of labels for the vertical axes of the companion graphs. If provided, it should be the same length as ys. |
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 |
showlegend |
Show the plot legend (TRUE) or not (FALSE). |
legendtitle |
The title for the plot legend. |
spacing |
A value between 0 and 1 for the space between the companion graphs. |
plotheight |
The height of the stack of companion graphs, e.g., "100vh" or "400px". |
A stack of plotly scatterplots.
library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) # Linked time series of speed, headings (in GPS and gyro), and GPS quality driveplot_companions( shareddata = shared_drive, x = time_cst, ys = c(speed_mph, gyro_heading, gps_heading), colorvar = gps_pdop, xlabel = "Time", ylabels = c( "Speed (mph)", "Gyro Heading (degrees)", "GPS Heading (degrees)" ), colorpalette = "viridis", legendtitle = "GPS PDOP" )library(crosstalk) data(drive7) shared_drive <- SharedData$new(drive7) # Linked time series of speed, headings (in GPS and gyro), and GPS quality driveplot_companions( shareddata = shared_drive, x = time_cst, ys = c(speed_mph, gyro_heading, gps_heading), colorvar = gps_pdop, xlabel = "Time", ylabels = c( "Speed (mph)", "Gyro Heading (degrees)", "GPS Heading (degrees)" ), colorpalette = "viridis", legendtitle = "GPS PDOP" )
Create a standalone map
driveplot_map( shareddata, lng = NULL, lat = NULL, colorvar = NULL, label = NA, colorpalette = NULL, fillopacity = 1, mapheight = "100vh" )driveplot_map( shareddata, lng = NULL, lat = NULL, colorvar = NULL, label = NA, colorpalette = NULL, fillopacity = 1, mapheight = "100vh" )
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). |
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 |
fillopacity |
The opacity of the fill of the map points (0 to 1). |
mapheight |
The height of the map, e.g, "100vh" or 400px". |
A leaflet map.
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" )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" )
Helper function
leaflet_color_palettes()leaflet_color_palettes()
In a DrivePlotR plot map, the map uses the same color palette as the companion graphs.
Vector of viridis color palettes supported by Leaflet.
leaflet_color_palettes()leaflet_color_palettes()
This dataset contains 28 drives ranging in length from just over 2 hours to just 45 secs.
nds_datands_data
A tibble with 23187 rows and 35 columns
integer, identifier for a drive; a drive is defined as the time between starting the car and turning it off again.
POSIXct time stamp for each observation in UTC
POSIXct time stamp for each observation in Central time
GPS-based measurements for each observation:
numeric, geographic longitude in degrees with CRS WGS84
numeric, geographic latitude in degrees with CRS WGS84
numeric, elevation above sea-level (in m)
numeric, continuity-corrected direction of the car (in degrees with north at 0 degrees and increasing clockwise) as measured by GPS. The continuity correction takes the initial GPS heading and adds the cumulative sum of the changes in GPS heading for the subsequent observations.
numeric, value specifying the adequacy of the GPS fix, where 0 = no fix, 1 = time only, 2 = 2D fix, 3 = 3D fix. A gps_fix of 3 is needed for good GPS data.
integer, the number of satellites covering a position.
numeric, position dilution of precision, an overall GPS data quality measure (lower is better)
numeric, horizontal dilution of precision, a GPS quality measure for latitude/longitude data (lower is better)
numeric, vertical dilution of precision, a GPS quality measure for elevation data (lower is better)
numeric, speed of the vehicle (in miles per hour)
character, the source of the reported speed, either "gps" or "obd"
numeric, distance traveled during a drive (in miles)
Measurements by the on-board gyroscope:
numeric, measure of vehicle acceleration along the front-back (longitudinal) axis (in g)
numeric, measure of vehicle acceleration along the right-left (lateral) axis (in g)
numeric, measure of acceleration of the vehicle in the up-down plane (normal/yaw axis) (in g)
numeric, sequential (over time) variable marking when consecutive acceleration values (absolute value of accel_x/y) exceed a threshold of 0.35g for a minimum of 1 second
character, severity categorization of acceleration event into low (0.35-0.44g), medium (0.45-0.59g), and high (>0.6g)
numeric, angular rotation rate about the right-to-left axis (in degrees/sec)
numeric, angular rotation rate about the forward-to-backward axis (in degrees/sec)
numeric, angular rotation rate about the up-to-down axis (in degrees/sec)
numeric, calculated heading utilizing compass data and gyro data (in degrees with north at 0 degrees and increasing clockwise). Note that we use non-standard congruence classes for continuity of consecutive values. Due to errors in the raw gyro heading, we use the initial GPS heading value as the initial heading value and then subtract the cumulative sum of gyro_z for the subsequent observations to calculate gyro_heading.
numeric, lateral gravity (in g)
numeric, longitudinal gravity (in g)
numeric, gravity (up-down) (in g)
numeric, angle about the forward-to-backward axis. 0 = level, positive = tilted to the left (in degrees)
numeric, angle about the left-to-right axis where 0 = level, positive = tilted downward (i.e., vehicle going downhill) (in degrees)
numeric, current engine revolutions per minute value
numeric, engine throttle as a percentage (0-100%)
numeric, the cumulative distance driven in miles at each observation
factor, the minute component of the timestamp for each observation (00 to 59)
Raw heading measurements:
numeric, raw GPS heading without continuity correction (in degrees)
numeric, raw gyro heading without continuity correction (in degrees)