View source: R/driveplot_companion.R
| driveplot_companion | R Documentation |
Make a single plotly scatter plot from shared drive data
driveplot_companion(
shareddata,
x,
y,
group = NULL,
colorvar = NULL,
colorpalette = NULL,
fillopacity = 1,
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. |
group |
The bare (unquoted) column from shareddata for the grouping variable. |
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 |
fillopacity |
The opacity of the fill of the points (0 to 1). |
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"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.