intervals (version 0.15.1)

plot.Intervals: Plotting methods for interval objects

Description

S3 methods for plotting "Intervals" and "Intervals_full" objects.

Usage

# S3 method for Intervals
plot(x, y, ...)
# S3 method for Intervals_full
plot(
     x, y = NULL,
     axes = TRUE,
     xlab = "", ylab = "",
     xlim = NULL, ylim = NULL,
     col = "black", lwd = 1,
     cex = 1,
     use_points = TRUE,
     use_names = TRUE,
     names_cex = 1,
     ...
     )

# S4 method for Intervals,missing plot(x, y, ...) # S4 method for Intervals_full,missing plot(x, y, ...) # S4 method for Intervals,ANY plot(x, y, ...) # S4 method for Intervals_full,ANY plot(x, y, ...)

Arguments

x

An "Intervals" or "Intervals_full" object.

y

Optional vector of heights at which to plot intervals. If omitted, y will be automatically computed to generate a compact plot but with no overlap.

axes

As for plot.default.

xlab

As for plot.default.

ylab

As for plot.default.

xlim

As for plot.default.

ylim

If not explicitly supplied, ylim is set to the maximum value required for intervals which are visible for the given xlim.

col

Color used for segments and endpoint points and interiors. Recycled if necessary.

lwd

Line width for segments. See par.

cex

Endpoint magnification. Only relevant if use_points = TRUE. See par.

use_points

Should points be plotted at interval endpoints?

use_names

Should rownames(x) by used for segment labels in the plot?

names_cex

Segment label magnification. Only relevant if use_names = TRUE.

...

Other arguments for plot.default.

Value

None.

Details

Intervals with NA for either endpoint are not plotted. Vertical placement is on the integers, beginning with 0.

Examples

Run this code
# NOT RUN {
# Note plot symbol for empty interval in 'from'.

from <- Intervals(
                  matrix(
                         c(
                            2,  8,
                            8,  9,
                            6,  9,
                           11, 12,
                            3,  3
                           ),
                         ncol = 2, byrow = TRUE
                         ),
                  closed = c( FALSE, TRUE ),
                  type = "Z"
                  )

rownames(from) <- c("a","b","c","d","e")

to <- Intervals(
                matrix(
                       c(
                         2,  8,
                         3,  4,
                         5, 10
                         ),
                       ncol = 2, byrow = TRUE
                       ),
                closed = c( FALSE, TRUE  ),
                type = "Z"
                )

rownames(to) <- c("x","y","z")

empty(from)

plot(
     c(from,to),
     col = rep(1:2, c(nrow(from), nrow(to)))
     )

legend("topright", c("from","to"), col=1:2, lwd=1)

# More intervals. The maximal height shown is adapted to the plotting
# window.

B <- 10000
left <- runif( B, 0, 1e5 )
right <- left + rexp( B, rate = 1/10 )
x <- Intervals( cbind( left, right ) )

plot(x, use_points=FALSE)
plot(x, use_points=FALSE, xlim = c(0, 500))
# }

Run the code above in your browser using DataLab