kpPlotLoess | R Documentation |
Plot a LOESS smoothed line with confidence intervals given a list of points.
kpPlotLoess(karyoplot, data=NULL, chr=NULL, x=NULL, y=NULL, conf.interval=0.95, span=0.5, data.panel=1, r0=NULL, r1=NULL, ymin=NULL, ymax=NULL, col="black", lty=1, lwd=1, ci.col="#888888AA", ci.border=NA, ci.border.lty=1, ci.border.lwd=1, clipping=TRUE, ...)
karyoplot |
(a |
data |
(a |
chr |
(a charecter vector) A vector of chromosome names specifying the chromosomes of the data points. If |
x |
(a numeric vector) A numeric vector with the positions (in base pairs) of the data points in the chromosomes. If |
y |
(a numeric vector) A numeric vector with the values of the data points. If |
conf.interval |
The confidence interval to plot. If a number in (0,1), the confidence interval is plotted. Else, no confidence interval is plotted. (defaults to 0.95) |
span |
A parameter to control the smoothing level. It is passed to underlying function |
data.panel |
(numeric) The identifier of the data panel where the data is to be plotted. The available data panels depend on the plot type selected in the call to |
r0 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
r1 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
ymin |
(numeric) The minimum value of |
ymax |
(numeric) The maximum value of |
col |
The color of the fitting line. (defaults to "black") |
lty |
The line type (dashed, dotted...) of the fitting line (defaults to 1, solid) |
lwd |
The line width of the fitting line (defaults to 1) |
ci.col |
The color of the area representing the confidence interval. If NA no CI is plotted. (defaults to #888888AA, transparent gray) |
ci.border |
The color of line marking the border of the confidence interval. If NA, it's not plotted. (defaults to NA) |
ci.border.lty |
The line type of line marking the border of the confidence interval. (defaults to 1, solid) |
ci.border.lwd |
The line width of line marking the border of the confidence interval. (defaults to 1) |
clipping |
(boolean) Only used if zooming is active. If TRUE, the data representation will be not drawn out of the drawing area (i.e. in margins, etc) even if the data overflows the drawing area. If FALSE, the data representation may overflow into the margins of the plot. (defaults to TRUE) |
... |
The ellipsis operator can be used to specify any additional graphical parameters. Any additional parameter will be passed to the internal calls to the R base plotting functions. |
Given a set of data points (specified in any way accepted by kpPoints
),
plot a LOESS smoothed line with optional confidence intervals. LOESS is
computed independently per each chromosome and data points are sorted before
fitting. It is possible to adjust the confidence interval with
conf.interval
and setting it to NULL or NA will plot no CI. It is also
possible to control the smoothing level with span
. In addition to
the standard plotting parameters, it is possible to control independently the
color of the fitting line and CI area and CI borders. It is also possible to
adjust the line type and line width of the fitting line and CI border.
Returns the original karyoplot object, unchanged.
plotKaryotype
, kpPoints
, kpLines
, kpPlotRibbon
set.seed(1000)
dd <- data.frame(chr="chr1", x=1:48*5e6, y=rnorm(n=48, 0.5, 0.1 ))
kp <- plotKaryotype(chromosomes="chr1")
kpPoints(kp, chr=dd$chr, x=dd$x, y=dd$y)
kpPlotLoess(kp, chr=dd$chr, x=dd$x, y=dd$y, col="red", conf.interval = 0.99, ci.col = "#FAAAAAAA")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.