I used the wrong address. This was meant as a reply to another post.
On 10/17/07 10:55, thomas.schwander at mvv.de wrote:> Hi Jonathan,
>
> I read your post in the R-Help. Did you get rid off the problem? I'm
standing inf
> ront of the same problem... If you've got an answer to me to drae a
curly bracket,
> could you please be so kind to tell me who you did?
I missed the beginning of this thread, but perhaps this is an answer.
Look at the Brack function. The result is in the Brown article here:
http://journal.sjdm.org/vol1.2.htm
(near the end).
library(grid)
# function to draw curly braces in red
# x1...y2 are the ends of the brace
# for upside down braces, x1 > x2 and y1 > y2
Brack <- function(x1,y1,x2,y2,h)
{
x2 <- x2-x1; y2 <- y2-y1
v1 <- viewport(x=x1,y=y1,width=sqrt(x2^2+y2^2),
height=h,angle=180*atan2(y2,x2)/pi,
just=c("left","bottom"),gp=gpar(col="red"))
pushViewport(v1)
grid.curve(x2=0,y2=0,x1=.125,y1=.5,curvature=.5)
grid.move.to(.125,.5)
grid.line.to(.375,.5)
grid.curve(x1=.375,y1=.5,x2=.5,y2=1,curvature=.5)
grid.curve(x2=1,y2=0,x1=.875,y1=.5,curvature=-.5)
grid.move.to(.875,.5)
grid.line.to(.625,.5)
grid.curve(x2=.625,y2=.5,x1=.5,y1=1,curvature=.5)
popViewport()}
grid.newpage()
grid.move.to(.25,.3)
grid.line.to(.25,.7)
grid.line.to(.95,.3)
grid.line.to(.25,.3)
grid.move.to(.25,.5)
grid.line.to(.95,.3,gp=gpar(lty="dashed"))
grid.move.to(.25,.7)
grid.line.to(.6,.3,gp=gpar(lty="dashed"))
Brack(.95,.29,.25,.29,.03)
Brack(.255,.71,.955,.31,.03)
Brack(.25,.70,.6,.3,.03)
Brack(.25,.50,.95,.3,.03)
Brack(.24,.3,.24,.7,.03)
#Brack(.25,.497,.25,.3,.03)
# What follows is not so elegant,
# but it illustrates the use of arrow().
grid.text("Room for improvement in logic",x=.1,y=.5,rot=90)
grid.move.to(.125,.45)
grid.line.to(.125,.55,arrow=arrow(length=unit(.015,"npc")))
grid.text("Room for improvement in elicitation",x=.6,y=.16)
grid.move.to(.55,.135)
grid.line.to(.65,.135,arrow=arrow(length=unit(.015,"npc")))
grid.text("NOW",x=.19,y=.5,rot=90)
grid.text("NOW",x=.6,y=.23)
grid.text("NOW",x=.63,y=.555,rot=180*atan2(-4,7)/pi,)
grid.text("After E",x=.465,y=.53,rot=180*atan2(-4,3.5)/pi,)
grid.text("After L",x=.615,y=.44,rot=180*atan2(-2,7)/pi,)
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
Editor: Judgment and Decision Making (http://journal.sjdm.org)