Skip to main content
Topic: Vectorized Colors for plotting XChromatogram (Read 3903 times) previous topic - next topic

Vectorized Colors for plotting XChromatogram

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]

Re: Vectorized Colors for plotting XChromatogram

Reply #1
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
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
good question - but yes, it should be valid with these package versions.

 

Re: Vectorized Colors for plotting XChromatogram

Reply #4
What exactly is the difference between these package versions and the rest of them?