powered by
Add moving average lines with different window widths to a plot
movAvLines( x = 1:length(y), y, widths = c(3, 5, 7, 9, 11, 13), weights, col = "blue", alpha = 0.3, add = TRUE, las = 1, ... )
x values of data. DEFAULT: 1:length(y)
y values that are smoothed with several window widths
widths of movAv windows. DEFAULT: 2:7*2-1
movAv
weights within each window
color passed to addAlpha. DEFAULT: "blue"
addAlpha
transparency passed to addAlpha. DEFAULT: 0.3
Logical: Add to existing plot?Set to FALSE to first create the scatterplot. DEFAULT: TRUE
LabelAxisStyle (only relevant if add=FALSE). DEFAULT: 1
further arguments passed to lines
lines
Berry Boessenkool, berry-b@gmx.de, May 2015
movAv, addAlpha
set.seed(42) movAvLines(y=cumsum(rnorm(50)), add=FALSE, lwd=3)
Run the code above in your browser using DataLab