Re: [R] How to change the type of segments ends?

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sat 08 Jul 2006 - 02:10:45 EST

You need angle=90. From the help page:

    angle: angle from the shaft of the arrow to the edge of the arrow

           head.

On Fri, 7 Jul 2006, Lu, Jiang Jane wrote:

> Hi,
>
> I am trying to plot odds ratios and the corresponding confidence
> intervals in horizontal segments. It would be ideal if the confidence
> interval segment can be drawn with little vertical bars at both ends. I
> have tried very hard to change the type of ends by using 'lend'
> arguments, but cannot make it. I even tried 'arrows()', but still
> failed. Following is the code I use:
> ====================================================
> drug.or <- c(1.017,1.437,1.427,2.211)
> drug.orl <- c(0.715,1.075,1.103,1.696)
> drug.oru <- c(1.446,1.922,1.845,2.882)
>
> yaxis <- seq(1,4,by=1)
>
> plot(x=drug.or,y=yaxis,type='p',pch=17,xlim=c(0,3),axes=FALSE,
> xlab='Odds Ratio',ylab='',main='Reference Group: A only')
> axis(1,at=seq(0,3,by=0.5),labels=paste(seq(0,3,by=0.5)))
> axis(2,at=yaxis,las=2)
>
>
> segments(x0=drug.orl,x1=drug.oru,y0=yaxis,y1=yaxis,col=4,lend=2)
>
> # or try
> #arrows(x0=drug.orl,x1=drug.oru,y0=yaxis,y1=yaxis,length=0.1,angle=0,cod
> e=3,col=4,lend=2)
>
> box()
> =====================================================
>
>
> Any comments or suggestions would be greatly appreciated.
>
>
> Jane
>
> University of Pittsburgh
> Pittsburgh, PA 15261
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jul 08 02:22:45 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 08 Jul 2006 - 04:15:22 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.