Topic: Vectorized Colors for plotting XChromatogram (Read 2909 times)

Vectorized Colors for plotting XChromatogram

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

Re: Vectorized Colors for plotting XChromatogram

Reply #1 – 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

Re: Vectorized Colors for plotting XChromatogram

Reply #2 – 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

Re: Vectorized Colors for plotting XChromatogram

Reply #3 – September 12, 2019, 03:19:50 AM
good question - but yes, it should be valid with these package versions.

Re: Vectorized Colors for plotting XChromatogram

Reply #4 – October 03, 2019, 04:17:32 AM
What exactly is the difference between these package versions and the rest of them?