diff --git a/DESCRIPTION b/DESCRIPTION index 605680db2f3117fae70a32212e2b5d106a483fd4..5e2ea25fde9e2f763042be3fd421c757a1b8b097 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,4 +23,5 @@ Imports: RMassBank, parallel, yaml, - mzR + mzR, + RColorBrewer diff --git a/R/mix.R b/R/mix.R index dc14ce5a49baf1dd5eedc66785c40e94263b1585..c1a2ee603acf072b3637770ec66c5b6b16fd97e9 100644 --- a/R/mix.R +++ b/R/mix.R @@ -542,10 +542,11 @@ presc.p<-function(fn_data,fn_cmpd_l,mode,cl=NULL,ppm_lim_fine=10,EIC_limit=0.001 ##' @title Plot the Output of Prescreen ##' @param wd Sequence of data dirs containing the prescreen subdir. ##' @param out The name of the output file. +##' @param pal ColorBrewer palette name. ##' @return Nothing useful. ##' @author Todor Kondić ##' @export -presc.plot <- function(wd,out="prescreen.pdf") { +presc.plot <- function(wd,out="prescreen.pdf",pal="Accent") { dfdir <- file.path(wd,"prescreen") pdf(out) ## Get the basenames of eic files. @@ -569,10 +570,12 @@ presc.plot <- function(wd,out="prescreen.pdf") { int_rng <- range(sapply(dfs,function(x) x$intensity)) plot.window(rt_rng,int_rng) box() - + cols <- RColorBrewer::brewer.pal(n=length(dfs),name=pal) ## Plot eic across the directory set. - for (df in dfs) { - lines(df$intensity ~ df$rt) + for (n in seq(length(dfs))) { + df <- dfs[[n]] + col <- cols[[n]] + lines(df$intensity ~ df$rt,col=col) } ## Find existing children and plot them across the directory diff --git a/man/presc.plot.Rd b/man/presc.plot.Rd index f8bfe688135df47c34ddfb7b60c87b29280dc3f0..4630dd77f1fcd33a50be160bcb703a0ee799c235 100644 --- a/man/presc.plot.Rd +++ b/man/presc.plot.Rd @@ -4,12 +4,14 @@ \alias{presc.plot} \title{Plot the Output of Prescreen} \usage{ -presc.plot(wd, out = "prescreen.pdf") +presc.plot(wd, out = "prescreen.pdf", pal = "Accent") } \arguments{ \item{wd}{Sequence of data dirs containing the prescreen subdir.} \item{out}{The name of the output file.} + +\item{pal}{ColorBrewer palette name.} } \value{ Nothing useful.