plott {tagtools} | R Documentation |
Plot tag data time series
Description
Plot time series in a single or multi-paneled figure, using ggplot2 graphics for static graphs and plotly for interactive ones. This is useful, for example, for comparing measurements across different sensors in an animaltag data object. The time axis is automatically displayed in seconds, minutes, hours, or days according to the span of the data.
Usage
plott(
X,
fsx = NULL,
r = FALSE,
offset = 0,
date_time_axis = FALSE,
recording_start = NULL,
panel_heights = rep.int(1, length(X))/length(X),
panel_labels = names(X),
line_colors,
interactive = FALSE,
draw = TRUE
)
Arguments
X |
List whose elements are either lists (containing data and metadata) or vectors/matrices of time series data. See details. |
fsx |
(Optional) A numeric vector whose length matches the number of sensor data streams (list elements) in X. (If shorter, |
r |
(Optional) Logical. Should the direction of the y-axis be flipped? Default is FALSE. If |
offset |
(Optional) A vector of offsets, in seconds, between the start of each sensor data stream and the start of the first one. For example, if acceleration data collection started and then depth data collection commenced 436 seconds later, then the |
date_time_axis |
(Optional) Logical. Should the x-axis units be date-times rather than time-since-start-of-recording? Ignored if |
recording_start |
(Optional) The start time of the tag recording as a |
panel_heights |
(Optional) A vector of relative or absolute heights for the different panels (one entry for each sensor data stream in |
panel_labels |
(Optional) A list of y-axis labels for the panels. Defaults to names(X). |
line_colors |
(Optional) A list of colors for lines for multivariate data streams (for example, if a panel plots tri-axial acceleration, it will have three lines – their line colors will be the first three in this list). May be specified in any specification R understands for colors. Defaults to c("#000000", "#009E73", "#9ad0f3", "#0072B2", "#e79f00", "#D55E00") |
interactive |
(Optional) Should an interactive figure (allowing zoom/pan/etc.) be produced? Default is FALSE. Interactive plotting requires the package plotly. |
draw |
(Optional) Whether or not to draw the plot. Defaults to TRUE. If FALSE, a list of ggplot objects (if interactive is FALSE; this list is suitable to plot with |
Details
If the input data X is an animaltag
object, then all sensor variables in the object will be plotted. To plot only selected sensors from the animaltag
object my_tag
, for example, the input X=list(my_tag$A, my_tag$M) would plot just the accelerometer and magnetometer data. If possible, the plot will have
Value
A plot of time-series data created with ggplot or plotly. If you prefer base R graphics, consider function plott_base
instead.
Note
This is a flexible plotting tool which can be used to display and explore sensor data with different sampling rates on a uniform time grid.
Examples
plott(list(depth = harbor_seal$P, Accel = harbor_seal$A))