| 1 |
\name{plot.Intervals} |
| 2 |
|
| 3 |
\alias{plot} |
| 4 |
\alias{plot.Intervals} |
| 5 |
\alias{plot.Intervals_full} |
| 6 |
\alias{plot,Intervals,missing-method} |
| 7 |
\alias{plot,Intervals_full,missing-method} |
| 8 |
\alias{plot,Intervals,ANY-method} |
| 9 |
\alias{plot,Intervals_full,ANY-method} |
| 10 |
|
| 11 |
\title{Plotting methods for interval objects} |
| 12 |
|
| 13 |
\description{ |
| 14 |
S3 methods for plotting \code{"Intervals"} and \code{"Intervals_full"} |
| 15 |
objects. |
| 16 |
} |
| 17 |
|
| 18 |
\usage{ |
| 19 |
\S3method{plot}{Intervals}(x, y, ...) |
| 20 |
\S3method{plot}{Intervals_full}( |
| 21 |
x, y = NULL, |
| 22 |
axes = TRUE, |
| 23 |
xlab = "", ylab = "", |
| 24 |
xlim = NULL, ylim = NULL, |
| 25 |
col = "black", lwd = 1, |
| 26 |
cex = 1, |
| 27 |
use_points = TRUE, |
| 28 |
use_names = TRUE, |
| 29 |
names_cex = 1, |
| 30 |
... |
| 31 |
) |
| 32 |
|
| 33 |
\S4method{plot}{Intervals,missing}(x, y, ...) |
| 34 |
\S4method{plot}{Intervals_full,missing}(x, y, ...) |
| 35 |
\S4method{plot}{Intervals,ANY}(x, y, ...) |
| 36 |
\S4method{plot}{Intervals_full,ANY}(x, y, ...) |
| 37 |
} |
| 38 |
|
| 39 |
\arguments{ |
| 40 |
|
| 41 |
\item{x}{An \code{"Intervals"} or \code{"Intervals_full"} object.} |
| 42 |
|
| 43 |
|
| 44 |
\item{y}{ |
| 45 |
Optional vector of heights at which to plot intervals. If omitted, |
| 46 |
\code{y} will be automatically computed to generate a compact plot |
| 47 |
but with no overlap. |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
\item{axes}{As for \code{\link{plot.default}}.} |
| 52 |
|
| 53 |
\item{xlab}{As for \code{\link{plot.default}}.} |
| 54 |
|
| 55 |
\item{ylab}{As for \code{\link{plot.default}}.} |
| 56 |
|
| 57 |
\item{xlim}{As for \code{\link{plot.default}}.} |
| 58 |
|
| 59 |
\item{ylim}{ |
| 60 |
If not explicitly supplied, \code{ylim} is set to the maximum value |
| 61 |
required for intervals which are visible for the given \code{xlim}. |
| 62 |
} |
| 63 |
|
| 64 |
\item{col}{ |
| 65 |
Color used for segments and endpoint points and interiors. Recycled |
| 66 |
if necessary. |
| 67 |
} |
| 68 |
|
| 69 |
\item{lwd}{Line width for segments. See \code{\link{par}}.} |
| 70 |
|
| 71 |
\item{cex}{ |
| 72 |
Endpoint magnification. Only relevant if \code{use_points = |
| 73 |
TRUE}. See \code{\link{par}}. |
| 74 |
} |
| 75 |
|
| 76 |
\item{use_points}{Should points be plotted at interval endpoints?} |
| 77 |
|
| 78 |
\item{use_names}{ |
| 79 |
Should \code{rownames(x)} by used for segment labels in the plot? |
| 80 |
} |
| 81 |
|
| 82 |
\item{names_cex}{ |
| 83 |
Segment label magnification. Only relevant if \code{use_names = |
| 84 |
TRUE}. |
| 85 |
} |
| 86 |
|
| 87 |
\item{...}{Other arguments for \code{\link{plot.default}}.} |
| 88 |
|
| 89 |
} |
| 90 |
|
| 91 |
\details{ |
| 92 |
Intervals with \code{NA} for either endpoint are not |
| 93 |
plotted. Vertical placement is on the integers, beginning with 0. |
| 94 |
} |
| 95 |
|
| 96 |
\value{None.} |
| 97 |
|
| 98 |
\examples{ |
| 99 |
# Note plot symbol for empty interval in 'from'. |
| 100 |
|
| 101 |
from <- Intervals( |
| 102 |
matrix( |
| 103 |
c( |
| 104 |
2, 8, |
| 105 |
8, 9, |
| 106 |
6, 9, |
| 107 |
11, 12, |
| 108 |
3, 3 |
| 109 |
), |
| 110 |
ncol = 2, byrow = TRUE |
| 111 |
), |
| 112 |
closed = c( FALSE, TRUE ), |
| 113 |
type = "Z" |
| 114 |
) |
| 115 |
|
| 116 |
rownames(from) <- c("a","b","c","d","e") |
| 117 |
|
| 118 |
to <- Intervals( |
| 119 |
matrix( |
| 120 |
c( |
| 121 |
2, 8, |
| 122 |
3, 4, |
| 123 |
5, 10 |
| 124 |
), |
| 125 |
ncol = 2, byrow = TRUE |
| 126 |
), |
| 127 |
closed = c( FALSE, TRUE ), |
| 128 |
type = "Z" |
| 129 |
) |
| 130 |
|
| 131 |
rownames(to) <- c("x","y","z") |
| 132 |
|
| 133 |
empty(from) |
| 134 |
|
| 135 |
plot( |
| 136 |
c(from,to), |
| 137 |
col = rep(1:2, c(nrow(from), nrow(to))) |
| 138 |
) |
| 139 |
|
| 140 |
legend("topright", c("from","to"), col=1:2, lwd=1) |
| 141 |
|
| 142 |
# More intervals. The maximal height shown is adapted to the plotting |
| 143 |
# window. |
| 144 |
|
| 145 |
B <- 10000 |
| 146 |
left <- runif( B, 0, 1e5 ) |
| 147 |
right <- left + rexp( B, rate = 1/10 ) |
| 148 |
x <- Intervals( cbind( left, right ) ) |
| 149 |
|
| 150 |
plot(x, use_points=FALSE) |
| 151 |
plot(x, use_points=FALSE, xlim = c(0, 500)) |
| 152 |
} |