Make a single plotly scatter plot from shared drive data
driveplot_companion.RdMake a single plotly scatter plot from shared drive data
Usage
driveplot_companion(
shareddata,
x,
y,
colorvar = NULL,
colorpalette = "#03F",
xlabel = NULL,
ylabel = NULL,
showlegend = TRUE,
legendtitle = NULL
)Arguments
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 "viridis", "inferno", "magma", or "plasma".
- 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.
Examples
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")