% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/kpAbline.R
\name{kpAbline}
\alias{kpAbline}
\title{kpAbline}
\usage{
kpAbline(karyoplot, chr=NULL, h=NULL, v=NULL, ymin=NULL, ymax=NULL, data.panel=1, r0=NULL, r1=NULL,  clipping=TRUE, ...)
}
\arguments{
\item{karyoplot}{(a \code{KaryoPlot} object) This is the first argument to all data plotting functions of \code{karyoploteR}. A KaryoPlot object referring to the currently active plot.}

\item{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)}

\item{h}{(a numeric vector) A numeric vector with the heights where the horizontal lines will be plotted. If \code{h} is NULL, no horizontal lines will be plotted. (defaults to NULL)}

\item{v}{(a numeric vector) A numeric vector with the positions (in base pairs) where the vertical lines will be plotted. If \code{v} is NULL, no vertical lines will be plotted. (defaults to NULL)}

\item{ymin}{(numeric) The minimum value of \code{y} to be plotted. If NULL, it is set to the min value of the selected data panel. (defaults to NULL)}

\item{ymax}{(numeric) The maximum value of \code{y} to be plotted. If NULL, it is set to the max value of the selected data panel. (defaults to NULL)}

\item{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 \code{\link{plotKaryotype}}. (defaults to 1)}

\item{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)}

\item{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)}

\item{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)}

\item{...}{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.}
}
\value{
Returns the original karyoplot object, unchanged.
}
\description{
This is the \code{KaryoploteR} version of the \code{\link[graphics]{abline}} function to
add horizontal or vertical lines to the plot.
}
\details{
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 \code{\link[graphics]{segments}}.
}
\examples{

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")


}
\seealso{
\code{\link{plotKaryotype}}, \code{\link{kpSegments}}, \code{\link{kpLines}}
}
