dplot3_xt: Plot timeseries data

View source: R/dplot3_xt.R

dplot3_xtR Documentation

Plot timeseries data

Description

Plot timeseries data

Usage

dplot3_xt(
  x,
  y = NULL,
  x2 = NULL,
  y2 = NULL,
  which.xy = NULL,
  which.xy2 = NULL,
  shade.bin = NULL,
  shade.interval = NULL,
  shade.col = NULL,
  shade.x = NULL,
  shade.name = "",
  shade.showlegend = FALSE,
  ynames = NULL,
  y2names = NULL,
  xlab = NULL,
  ylab = NULL,
  y2lab = NULL,
  xunits = NULL,
  yunits = NULL,
  y2units = NULL,
  yunits.col = NULL,
  y2units.col = NULL,
  zt = NULL,
  show.zt = TRUE,
  show.zt.every = NULL,
  zt.nticks = 18L,
  main = NULL,
  main.y = 1,
  main.yanchor = "bottom",
  x.nticks = 0,
  y.nticks = 0,
  show.rangeslider = NULL,
  slider.start = NULL,
  slider.end = NULL,
  theme = rtTheme,
  palette = rtpalette(rtPalette),
  font.size = 16,
  yfill = "none",
  y2fill = "none",
  fill.alpha = 0.2,
  yline.width = 2,
  y2line.width = 2,
  x.showspikes = TRUE,
  spike.dash = "solid",
  spike.col = NULL,
  x.spike.thickness = -2,
  tickfont.size = 16,
  x.tickmode = "auto",
  x.tickvals = NULL,
  x.ticktext = NULL,
  x.tickangle = NULL,
  legend.x = 0,
  legend.y = 1.1,
  legend.xanchor = "left",
  legend.yanchor = "top",
  legend.orientation = "h",
  margin = list(l = 75, r = 75, b = 75, t = 75),
  x.standoff = 20L,
  y.standoff = 20L,
  y2.standoff = 20L,
  hovermode = "x",
  displayModeBar = TRUE,
  modeBar.file.format = "svg",
  scrollZoom = TRUE,
  filename = NULL,
  file.width = 960,
  file.height = 500,
  file.scale = 1,
  ...
)

Arguments

x

Datetime vector or list of vectors OR object of class xt. If xt, x2, y, y2, xunits, yunits, and y2units will be extracted from the object and the corresponding arguments will be ignored.

y

Numeric vector or named list of vectors: y-axis data.

x2

Datetime vector or list of vectors, optional: must be provided if y2 does not correspond to values in x. A single x-axis will be drawn for all values in x and x2.

y2

Numeric vector, optional: If provided, a second y-axis will be added to the right side of the plot

which.xy

Integer vector: Indices of x and y to plot. If not provided, will select up to the first two x-y traces.

which.xy2

Integer vector: Indices of x2 and y2 to plot. If not provided, will select up to the first two x2-y2 traces.

shade.bin

Integer vector 0, 1: Time points in x to shade on the plot. For example, if there are 10 time points in x, and you want to shade time points 3 to 7, shade.bin = c(0, 0, 1, 1, 1, 1, 1, 0, 0, 0). Only set shade.bin or shade.interval, not both.

shade.interval

List of numeric vectors: Intervals to shade on the plot. Only set shade.bin or shade.interval, not both.

shade.col

Color: Color to shade intervals.

shade.x

Numeric vector: x-values to use for shading.

shade.name

Character: Name for shaded intervals.

shade.showlegend

Logical: If TRUE, show legend for shaded intervals.

ynames

Character vector, optional: Names for each vector in y.

y2names

Character vector, optional: Names for each vector in y2.

xlab

Character: x-axis label.

ylab

Character: y-axis label.

y2lab

Character: y2-axis label.

xunits

Character: x-axis units.

yunits

Character: y-axis units.

y2units

Character: y2-axis units.

yunits.col

Color for y-axis units.

y2units.col

Color for y2-axis units.

zt

Numeric vector: Zeitgeber time. If provided, will be shown on the x-axis instead of x. To be used only with a single x vector and no x2.

show.zt

Logical: If TRUE, show zt on x-axis, if zt is provided.

show.zt.every

Integer: Show zt every show.zt.every ticks. If NULL, will be calculated to be x.nticks +/- 1 if x.nticks is not 0, otherwise 12 +/- 1.

zt.nticks

Integer: Number of zt ticks to show. Only used if show.zt.every is NULL. The actual number of ticks shown will depend on the periodicity of zt, so that zt = 0 is always included.

main

Character: Main title.

main.y

Numeric: Y position of main title.

main.yanchor

Character: "top", "middle", "bottom".

x.nticks

Integer: Number of ticks on x-axis.

y.nticks

Integer: Number of ticks on y-axis.

show.rangeslider

Logical: If TRUE, show a range slider.

slider.start

Numeric: Start of range slider.

slider.end

Numeric: End of range slider.

theme

Character or list: Name of theme or list of plot parameters.

palette

Color list: will be used to draw each vector in y and y2, in order.

font.size

Numeric: Font size for text.

yfill

Character: Fill type for y-axis: "none", "tozeroy", "tonexty"

y2fill

Character: Fill type for y2-axis: "none", "tozeroy", "tonexty"

fill.alpha

Numeric: Fill opacity for y-axis.

yline.width

Numeric: Line width for y-axis lines.

y2line.width

Numeric: Line width for y2-axis lines.

x.showspikes

Logical: If TRUE, show spikes on x-axis.

spike.dash

Character: Dash type for spikes: "solid", "dot", "dash", "longdash", "dashdot", "longdashdot".

spike.col

Color for spikes.

x.spike.thickness

Numeric: Thickness of spikes. -2 avoids drawing border around spikes.

tickfont.size

Numeric: Font size for tick labels.

x.tickmode

Character: "auto", "linear", "array".

x.tickvals

Numeric vector: Tick positions.

x.ticktext

Character vector: Tick labels.

x.tickangle

Numeric: Angle of tick labels.

legend.x

Numeric: X position of legend.

legend.y

Numeric: Y position of legend.

legend.xanchor

Character: "left", "center", "right".

legend.yanchor

Character: "top", "middle", "bottom".

legend.orientation

Character: "v" for vertical, "h" for horizontal.

margin

Named list with 4 numeric values: "l", "r", "t", "b" for left, right, top, bottom margins.

x.standoff

Numeric: Distance from x-axis to x-axis label.

y.standoff

Numeric: Distance from y-axis to y-axis label.

y2.standoff

Numeric: Distance from y2-axis to y2-axis label.

hovermode

Character: "closest", "x", "x unified"

displayModeBar

Logical: If TRUE, display plotly mode bar.

modeBar.file.format

Character: "png", "svg", "jpeg", "webp", "pdf": file format for mode bar image export.

scrollZoom

Logical: If TRUE, enable zooming by scrolling.

filename

Character: Path to file to save static plot.

file.width

Integer: File width in pixels for when filename is set.

file.height

Integer: File height in pixels for when filename is set.

file.scale

Numeric: If saving to file, scale plot by this number

...

Additional theme arguments.

Details

We are switching to palette being a color vector instead of the name of a built-in palette.

Value

A plotly object

Author(s)

EDG


egenn/rtemis documentation built on Nov. 22, 2024, 4:12 a.m.