hexMA.loess: Add Loess Fit to Hexplot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/hexPlotMA.R

Description

Fit a loess line using the hexagon centers of mass as the x and y coordinates and the cell counts as weights.

Usage

1
2
hexMA.loess(pMA, span = 0.4, col = "red", n = 200, ...)
hexVP.loess(hbin, hvp = NULL, span = 0.4, col = "red", n = 200, ...)

Arguments

hbin

an object of class hexbin, see hexbin.

hvp

A hexViewport object.

pMA

the list returned by plotMAhex.

span

the parameter alpha which controls the degree of smoothing.

col

line color for the loess fit.

n

number of points at which the fit should be evaluated.

...

Additional graphical parameter settings for the loess line fit; see gpar.

Value

Returns invisibly the object associated with the loess fit.

Author(s)

Nicholas Lewin-Koh

See Also

hexVP.abline, plotMAhex, gplot.hexbin, hexViewport; loess

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  if(require(marray)){
    data(swirl)
    
    hb <- plotMAhex(swirl[,1], main = "M vs A plot with hexagons", legend=0)
    hexVP.abline(hb$plot, h=0, col= gray(.6))
    hexMA.loess(hb)
  } 
  
  dat <- data.frame(x=rnorm(1000), y=rnorm(1000))
  bin <- hexbin(dat$x, dat$y)
  hb <- plot(bin)
  hexVP.loess(bin, hvp = hb$plot.vp, span = 0.4, n = 200, col = "blue", lwd = 3, lty = "dashed")

hexbin documentation built on Jan. 13, 2021, 5:37 a.m.