movAvLines: Moving average with different window widths

View source: R/movAvLines.R

movAvLinesR Documentation

Moving average with different window widths

Description

Add moving average lines with different window widths to a plot

Usage

movAvLines(
  x = 1:length(y),
  y,
  widths = c(3, 5, 7, 9, 11, 13),
  weights,
  col = "blue",
  alpha = 0.3,
  add = TRUE,
  las = 1,
  ...
)

Arguments

x

x values of data. DEFAULT: 1:length(y)

y

y values that are smoothed with several window widths

widths

widths of movAv windows. DEFAULT: 2:7*2-1

weights

weights within each window

col

color passed to addAlpha. DEFAULT: "blue"

alpha

transparency passed to addAlpha. DEFAULT: 0.3

add

Logical: Add to existing plot?Set to FALSE to first create the scatterplot. DEFAULT: TRUE

las

LabelAxisStyle (only relevant if add=FALSE). DEFAULT: 1

...

further arguments passed to lines

Author(s)

Berry Boessenkool, berry-b@gmx.de, May 2015

See Also

movAv, addAlpha

Examples


set.seed(42)
movAvLines(y=cumsum(rnorm(50)), add=FALSE, lwd=3)


brry/berryFunctions documentation built on Feb. 21, 2024, 2:20 p.m.