Description Usage Arguments Details Value See Also Examples
This is the KaryoploteR
version of the abline
function to
add horizontal or vertical lines to the plot.
1 |
karyoplot |
(a |
chr |
(a charecter vector) A vector of chromosome names specifying the chromosomes where the lines will be plotted. If NULL, the lines will be plotted in all chromosomes. (defaults to NULL) |
h |
(a numeric vector) A numeric vector with the heights where the horizontal lines will be plotted. If |
v |
(a numeric vector) A numeric vector with the positions (in base pairs) where the vertical lines will be plotted. If |
ymin |
(numeric) The minimum value of |
ymax |
(numeric) The maximum value of |
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) |
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. |
As with all other base-inspired low-level plotting functions in karyoploteR, the function
has been designed to accept mostly the same parameters as the base one (see the package
vignette for more information). In this case, however, the interface has been reduced
and it is only possible to plot vertical and horizontal lines and it's not possible to
provide an intercept and slope. In addition, the function accepts graphical parameters
that are valid for the base function segments
.
Returns the original karyoplot object, unchanged.
plotKaryotype
, kpSegments
, kpLines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | set.seed(1000)
data.points <- sort(createRandomRegions(nregions=1000, mask=NA))
mcols(data.points) <- data.frame(y=rnorm(1000, mean = 0.5, sd = 0.1))
kp <- plotKaryotype("hg19", plot.type=1, chromosomes=c("chr1", "chr2"))
kpDataBackground(kp, data.panel=1)
kpPoints(kp, data=data.points, pch=".", col="#2222FF", cex=3)
#Add horizontal lines at mean
kpAbline(kp, h=0.5, col="red")
#and at the 1 sd
kpAbline(kp, h=c(0.4, 0.6), col="orange", lwd=0.5)
#and 2 sd's
kpAbline(kp, h=c(0.3, 0.7), col="orange", lwd=0.5, lty=2)
#And add two vertical lines at specific chromosomal locations
kpAbline(kp, v=c(67000000, 190000000), chr="chr1")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.