Learn R Programming

RchivalTag (version 0.2.2)

dy_DepthTS: Plot time series data via the dygraphs interactive interface

Description

Plot time series data (e.g. depth or temperature time series from archival tags) via the dygraphs interactive interface.

Usage

dy_TS(ts_df, y="Depth", xlim, ylim, 
      ylab=y, xlab, main,
      ID, ID_label="Serial", 
      plot_DayTimePeriods=TRUE, twilight.set="ast", 
      color="darkblue",
      doRangeSelector=TRUE, drawPoints=FALSE, pointSize=2, tz="UTC", ...)

dy_DepthTS(ts_df, y="Depth", xlim, ylim, ylab=y, xlab, main, ID, ID_label="Serial", plot_DayTimePeriods=TRUE, twilight.set="ast", color="darkblue", doRangeSelector=TRUE, drawPoints=FALSE, pointSize=2, tz="UTC", ...)

Value

An interactive dygraph plot object that can be altered further using dyOptions.

Arguments

ts_df

data.frame holding the time series data to be plotted, including the x-vector 'datetime' (POSIXct, UTC) and the numeric y-vector whose label is defined by y.

y

Character label of the time series vector to be plotted (default "Depth").

xlim

X-axis limits (x1, x2) of the plot (default range(ts_df$datetime), but can be specified in empty.plot_TS).

ylim

Y-axis limits (default range(ts_df[[y]]), but can be specified in empty.plot_TS).

ylab, xlab

Axis labels.

main

Main title (default "Tag ID").

ID, ID_label

Tag ID and column label (default "Serial").

plot_DayTimePeriods, twilight.set

Whether day-time periods ("Night", "Dawn", "Day", "Dusk") should be shaded. If plot_DayTimePeriods=TRUE, twilight columns are required (or will be estimated via get_DayTimeLimits). twilight.set selects "ast" (astronomical) vs "naut" (nautical) twilight.

color

Line color (default "darkblue").

doRangeSelector

Whether to add dygraph interactive range selector (default TRUE).

drawPoints, pointSize

Whether to draw points at sampling times and their size.

tz

Time zone for the plot (default "UTC").

...

Additional arguments passed to dygraph. Further arguments can be passed via dyOptions.

Author

Robert K. Bauer

See Also

plot_TS, plot_DepthTempTS, dygraph, dyOptions

Examples

Run this code
### load sample depth and temperature time series data from miniPAT
# ts_file <- system.file("example_files/104659-Series.csv", package="RchivalTag")
# ts_df <- read_TS(ts_file)
# ts_df$Serial <- ts_df$DeployID
# head(ts_df)

## plot depth-time series data
# dy_DepthTS(ts_df)

## add missing Lon, Lat info for day/night shading
# ts_df$Lon <- 5; ts_df$Lat <- 43
# dy_DepthTS(ts_df)

## same figure with plot_DepthTS
# plot_DepthTS(ts_df, plot_DayTimePeriods=TRUE)

## further arguments
# dy_DepthTS(ts_df, xlim=unique(ts_df$date)[2:3], plot_DayTimePeriods=FALSE)

## add further options via dyOptions
# dg <- dy_DepthTS(ts_df, xlim=unique(ts_df$date)[2:3], plot_DayTimePeriods=FALSE, drawPoints=TRUE)
# dg <- dyOptions(dg, drawGrid=FALSE)
# dg

Run the code above in your browser using DataLab