swh:1:snp:81eadaa089e8253d8469bcef66aa332632c6c669
Tip revision: c79a04b5074656b36e591191eb8137b70a349932 authored by Hans W. Borchers on 30 June 2014, 00:00:00 UTC
version 1.7.0
version 1.7.0
Tip revision: c79a04b
figure.R
##
## f i g u r e . r Figure (Matlab Style)
##
figure <- function(figno, title = "") {
if (missing(figno)) figno <- NULL
else {
if (!is.numeric(figno) || length(figno) != 1 || floor(figno) != ceiling(figno))
stop("The figure handle must be a whole number.")
}
if (!is.null(figno)) {
if (figno == 1 || figno == -1) {
stop("Device 1 is the null device; cannot be opened or closed.")
} else if (figno == 0) {
stop("Requested figure handle 0 is in use by another object.")
}
}
# if (.Platform$OS.type == "unix") {
# if (.Platform$GUI == "AQUA") win <- quartz
# else if (.Platform$GUI == "X11") win <- X11
# else
# stop("Unknown platform GUI for Unix platform type.")
# } else if (.Platform$OS.type == "Linux") {
# win <- X11
# } else if (.Platform$OS.type == "windows") {
# win <- windows
# } else
# stop(paste("Unknown platform type:", .Platform$OS.type))
if (is.null(figno)) {
dev.new() # dev.new() may be platform independent
} else {
devl <- dev.list()
if (abs(figno) %in% devl) {
if (figno > 0) dev.set(figno)
else dev.off(-figno)
} else {
cat("Device", figno, "is not an open device. List of devices:\n")
return(devl)
}
}
invisible()
}