Metabolomics Society Forum

Software => R => XCMS => Topic started by: Tony on September 09, 2019, 04:41:02 AM

Title: Vectorized Colors for plotting XChromatogram
Post by: Tony on September 09, 2019, 04:41:02 AM
Dear Develops,

would it be possible for the plotting functions such as:

## XChromatograms {xcms}
## S4 method for signature 'XChromatogram,ANY'
## plot(x, col = "#00000060", lty = 1, type = "l", xlab = "retention time", ylab = "intensity", main = NULL, peakType = c("polygon", "point", "rectangle", "none"), peakCol = "#00000060", peakBg = "#00000020", peakPch = 1, ...)

## plotChromPeakDensity,XCMSnExp-method {xcms}         
## S4 method for signature 'XChromatograms'
##plotChromPeakDensity(object, param, col = "#00000060", xlab = "retention time", main = NULL, peakType = c("polygon", "point", "rectangle", "none"), peakCol = "#00000060", peakBg = "#00000020", peakPch = 1, simulate = TRUE, ...)

to have the arguments:
peakCol = "#00000060", peakBg = "#00000020" (maybe also peakPch = 1) to be able to take vectorized colors like in the argument col?

This would enable mor freedom whilst plotting.

kind regards
Tony

[attachment deleted by admin]
Title: Re: Vectorized Colors for plotting XChromatogram
Post by: johannes.rainer on September 09, 2019, 07:21:14 AM
Hi Tony,

excellent suggestion! The parameters are however already vectorized. peakCol, peakBg and peakPch can be either of length 1 or length equal to the number of peaks the XChromatogram/XChromatograms object has peaks (i.e. nrow(chromPeaks(x)) with x being a XChromatogram or an XChromatograms object). You can then define the color for each individual peak (the order of the colors passed along has to match the order of the peaks returned by chromPeaks.

cheers, jo
Title: Re: Vectorized Colors for plotting XChromatogram
Post by: Tony on September 09, 2019, 07:56:30 AM
Hi,

thanks, is this also valid for xcms in version 3.6.1, MSnbase 2.101?

kind regards
Tony
Title: Re: Vectorized Colors for plotting XChromatogram
Post by: johannes.rainer on September 12, 2019, 03:19:50 AM
good question - but yes, it should be valid with these package versions.
Title: Re: Vectorized Colors for plotting XChromatogram
Post by: Hulssay on October 03, 2019, 04:17:32 AM
What exactly is the difference between these package versions and the rest of them?