Partial implementation of "symbols"
Yusuke Uchiyama
me@naxgul.kais.kyoto-u.ac.jp
Sat, 6 Feb 1999 12:24:01 GMT
Hello,
I partially implemented the function "symbols". I would like to know if there have been already other person doing so. If not, would you please check my implementation and, if acceptable, please use it. I would like to implement other arguments if my function is accepted.
P.S. I am very glad to find that R is added to the software page of GNU web site.
Yusuke Uchiyama
yusuke@kais.kyoto-u.ac.jp
---cut here---
"symbols" <-
function (x, y = NULL, squares = NULL, rectangles = NULL, add = FALSE,
inches = TRUE, ...)
{
if (is.list(x)) {
y <- x[[2]]
x <- x[[1]]
}
if (is.array(x)) {
y <- x[, 2]
x <- x[, 1]
}
if (!is.null(rectangles)) {
symbols.rectangles(x, y, rectangles = rectangles, ...)
invisible()
}
if (!is.null(squares)) {
symbols.squares(x, y, squares = squares, ...)
invisible()
}
}
"symbols.rectangles" <-
function (x, y, rectangles, add = FALSE, inches = TRUE, ...)
{
xleft <- x - rectangles[1, ]/2
ybottom <- y - rectangles[2, ]/2
xright <- x + rectangles[1, ]/2
ytop <- y + rectangles[2, ]/2
if (add == FALSE) {
plot.new()
xlim <- c(min(xleft), max(xright))
ylim <- c(min(ybottom), max(ytop))
plot.window(xlim, ylim)
}
rect(xleft, ybottom, xright, ytop, ...)
invisible()
}
"symbols.squares" <-
function (x, y, squares, add = FALSE, inches = TRUE, ...)
{
xleft <- x - squares/2
ybottom <- y - squares/2
xright <- x + squares/2
ytop <- y + squares/2
if (add == FALSE) {
plot.new()
xlim <- c(min(xleft), max(xright))
ylim <- c(min(ybottom), max(ytop))
plot.window(xlim, ylim)
}
rect(xleft, ybottom, xright, ytop, ...)
invisible()
}
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._