Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions R/plot.Intervals_virtual.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ plot.Intervals_full <- function(
use_points = TRUE,
use_names = TRUE,
names_cex = 1,
text_col = NULL,
...
)
{
# Subset first, for efficiency, and so that the maximal y plotted is
# appropriate for the region shown.

if ( any( is.na( x ) ) ) x <- x[ !is.na(x), ]

if ( is.null(xlim) )
xlim <- range( x@.Data )
else
x <- x[ x[,2] >= xlim[1] & x[,1] <= xlim[2], ]

if ( is.null(y) )
y <- .Call( "_plot_overlap", x@.Data, closed(x), is( x, "Intervals_full" ) )

Expand All @@ -42,14 +43,14 @@ plot.Intervals_full <- function(
col = col,
lwd = lwd
)
if ( use_points ) {
if ( use_points ) {
# Careful with points...
adjust <- ( x[,1] == x[,2] ) & !closed(x)[,1]
closed(x)[ adjust, 2 ] <- FALSE
points(
x@.Data, rep( y, 2 ),
pch = 21, cex = cex,
col = col, bg = ifelse( closed(x), col, "white" )
col = col, bg = ifelse( closed(x), col, "white" )
)
}
if ( use_names && !is.null( rownames(x) ) ) {
Expand All @@ -59,12 +60,13 @@ plot.Intervals_full <- function(
rownames( x ),
pos = 3, offset = .5,
cex = names_cex,
xpd = NA
)
xpd = NA,
col = text_col
)
}
if ( axes )
axis( 1 )
}
}

plot.Intervals <- function( x, y = NULL, ... ) {
plot( as( x, "Intervals_full" ), y, ... )
Expand Down
7 changes: 6 additions & 1 deletion man/plot.Intervals.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use_points = TRUE,
use_names = TRUE,
names_cex = 1,
text_col = NULL,
...
)

Expand Down Expand Up @@ -84,6 +85,10 @@
TRUE}.
}

\item{text_col}{
Color of printed labels. Only relevant if \code{use_names = TRUE}.
}

\item{...}{Other arguments for \code{\link{plot.default}}.}

}
Expand Down Expand Up @@ -149,4 +154,4 @@ x <- Intervals( cbind( left, right ) )

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