#' @title Standard error plot
#' @author Jacques van Helden (\email{Jacques.van-Helden@@univ-amu.fr})
#' @description
#' Complement to the volcano plots generated by stats4bioinfo::tTestPerRow.plotVolcano()
#' Draw a plot that enables to compare
#' - standard error and significance
#' - mean difference, standard error and significance
#' @param multi.t Must be the data frame obtained with tTestPerRow()
#' @param col.points='#888888' Color(s) for the points
#' @param col.lines='blue' Color for the line highlighting the significance threshold
#' @param col.grid=#CCCCCC Grid color
#' @param col.positive='#00BB00' Color to highlight significant points (called positive)
#' @param ... Additional parameters are passed to the plot function
#' @examples
#' ## The object welch.table should have been generated with \code{\link{tTestPerRow}} (see examples in the doc)
#' stderPlot(welch.table)
#' @export
stderPlot <- function(multi.t,
col.points = '#888888',
col.grid = '#CCCCCC',
col.lines = 'blue',
col.positive='#00BB00',
...
) {
## Draw standard error as a function of Welch significance
plot(multi.t[,c('diff.stder','sig')],
xlab='Standard error of mean difference',
ylab='Welch significance (sig=-log10(e-value)',
col=col.points,
panel.first=grid(lty='solid',col=col.grid))
abline(h=0,col=col.lines,lwd=2)
points(multi.t[multi.t$sig > 0,c('diff.stder','sig')],col=col.positive)
}
stderPlotCircles <- function(multi.t,
col.points = '#888888',
col.grid = '#CCCCCC',
col.lines = 'blue',
col.positive='#00BB00',
... ## Plot standard error versus mean differences, with circles
) {
## proportional to significance
plot(multi.t[,c('means.diff', 'diff.stder')],
cex=multi.t$sig-min(multi.t$sig),
ylab='Standard error on the difference',
xlab='Difference between the means',
col=col.points,
panel.first=grid(lty='solid',col=col.grid))
abline(v=0, col=col.lines)
points(multi.t[multi.t$sig > 0,c('means.diff', 'diff.stder')],
cex=multi.t[multi.t$sig > 0,'sig']-min(multi.t$sig),
col=col.positive)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.