My question is probably stupid but why don't you use the text() function?
plot(1:10,type="n")
text(4,4,"{")
text(6,6,"{",cex=3) # if you want it bigger
Alain
On 19-Jul-10 17:20, Michael Friendly wrote:
I inherited a function written either for an older version of R or SPlus
to draw a brace, "{", in a graph. It uses par("uin") to determine the
scaling of the
quarter circles that make up segments of the brace, but that setting
doesn't
exist in current R.
I'm guessing that, in the function below, ux, uy can be defined from
par("usr") and par("pin"), but maybe someone remembers what par("uin")
was supposed to refer to.
brace <- function (x1 = 0, y1 = 0, x2 = 0, y2 = 1, right = TRUE, rad =
0.2)
{
uin <- par("uin")
ux <- uin[1]
uy <- uin[2]
dx <- x2 - x1
dy <- y2 - y1
alpha <- atan(ux * dx, uy * dy)
scale <- sqrt((ux * dx)^2 + (uy * dy)^2)
if (scale > 5 * rad)
rad <- rad/scale
qcirc <- cbind(cos((0:10) * pi/20), sin((0:10) * pi/20))
qcircr <- cbind(cos((10:0) * pi/20), sin((10:0) * pi/20))
rot <- function(theta) t(cbind(c(cos(theta), sin(theta)),
c(-sin(theta), cos(theta))))
seg1 <- t(t(rad * qcirc %*% rot(-pi/2)) + c(0, rad))
seg4 <- t(t(rad * qcirc) + c(0, 1 - rad))
seg3 <- t(t((rad * qcircr) %*% rot(pi)) + c(2 * rad, 0.5 +
rad))
seg2 <- t(t((rad * qcircr) %*% rot(pi/2)) + c(2 * rad, 0.5 -
rad))
bra <- rbind(seg1, seg2, seg3, seg4)
if (!right)
bra <- bra %*% diag(c(-1, 1))
bra <- scale * bra %*% rot(-alpha)
bra <- bra %*% diag(c(1/ux, 1/uy))
bra <- t(t(bra) + c(x1, y1))
bra
}
--
Alain Guillet
Statistician and Computer Scientist
SMCS - IMMAQ - Université catholique de Louvain
Bureau c.316
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium
tel: +32 10 47 30 50
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.