[BioC] MA-plot with print tip smooth curves

J.delasHeras at ed.ac.uk J.delasHeras at ed.ac.uk
Thu May 24 16:14:58 CEST 2007

Quoting João Fadista <Joao.Fadista at agrsci.dk>:

> Dear all,
> I would like to know how can I make an MA-plot where I can add   
> smooth curves that represent the trends characteristic to each print  
>  tip.
> See the desired plot in    
> http://www.stat.unc.edu/faculty/marron/DataAnalyses/SiZer/SiZer_Examples.html#Eg3:MicroArray   
> <http://www.stat.unc.edu/faculty/marron/DataAnalyses/SiZer/SiZer_Examples.html#Eg3:MicroArray>
> Kind regards,
> João Fadista

In Limma, the function 'plotPrintTipLoess' produces a figure with  
subplots representing each print tip group, and their loess curves.  
Not what you had in mind, but you may like it.

Alternatively, see ?scatter.smooth. You can use that function to add  
loess curves to your MA plot. I use a version I made of it (not very  
elegantly :) that allows me to choose more plotting parameters  
(colours etc) than the original. You can easily modify it further to  
suit your needs:

#tweak to scatter.smooth (more control over plotting parameters)

sm<-function (x, y = NULL, span = 2/3, degree = 1, family = c("symmetric",
     "gaussian"), xlab = NULL, ylab = NULL, ylim = NULL, xlim=NULL,  
evaluation = 50,
     pch=NULL, bg=NULL, cex=NULL, col=NULL, lwd=NULL, lty=NULL, lcol=NULL, ...)
     #xlabel <- if (!missing(x))
     #    deparse(substitute(x))
     #ylabel <- if (!missing(y))
     #    deparse(substitute(y))
     #xy <- xy.coords(x, y, xlabel, ylabel)
     #x <- xy$x
     #y <- xy$y
     #xlab <- if (is.null(xlab))
     #    xy$xlab
     #else xlab
     #ylab <- if (is.null(ylab))
     #    xy$ylab
     #else ylab
     prediction <- loess.smooth(x, y, span, degree, family, evaluation)
     if (is.null(ylim)) ylim<-range(y, prediction$y, na.rm = TRUE)
     if (is.null(xlim)) xlim<-range(x, prediction$x, na.rm = TRUE)
     if (is.null(pch)) pch<-16
     if (is.null(cex)) cex<-1
     if (is.null(col)) col<-"black"
     if (is.null(lwd)) lwd<-1
     if (is.null(lty)) lty<-1
     if (is.null(lcol)) lcol<-"red"
     plot(x, y, xlim = xlim, ylim = ylim, ,xlab = xlab, ylab = ylab,  
pch=pch, bg=bg, cex=cex, col=col)
     lines(prediction,lwd=lwd,lty=lty,col=lcol,ylim = ylim, xlim = xlim)


Dr. Jose I. de las Heras                      Email: J.delasHeras at ed.ac.uk
The Wellcome Trust Centre for Cell Biology    Phone: +44 (0)131 6513374
Institute for Cell & Molecular Biology        Fax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR

More information about the Bioconductor mailing list