Plotting Points

To plot points in a karyoplot we need to use the kpPoints function. Given a character vector chr and two integer vectors x and y it will plot points in the specifid positions.

library(karyoploteR)

x <- 1:23*10e6
y <- rnorm(23, mean=0.5, sd=0.25)

kp <- plotKaryotype(chromosomes="chr1")
kpPoints(kp, chr="chr1", x=x, y=y)

plot of chunk Figure1

The glyphs used to represent the points can be customized with the same graphical parameters as in the R base graphics points function: pch, cex, col

kp <- plotKaryotype(chromosomes="chr1")
kpPoints(kp, chr="chr1", x=x, y=y)
kpPoints(kp, chr="chr1", x=x, y=y, pch=1, cex=2, col="red")
kpPoints(kp, chr="chr1", x=x, y=y+0.15, cex=2, pch=1:23, col="blue")
kpPoints(kp, chr="chr1", x=x, y=y+0.3, cex=(1:23)/5, col=rainbow(23))

plot of chunk Figure2