[R] Question on "plotCI" function

Jim Lemon jim at bitwrit.com.au
Sat Feb 2 11:04:18 CET 2013


On 02/02/2013 02:21 AM, li li wrote:
> Thanks so much for the reply, Ista. I used "plotrix" library.
>
> Here is my example:
>
> xx<- seq(0.05, 0.95, by=0.05)
> lower<- c(-2.896865, -2.728416, -2.642574, -2.587724, -2.548672, -2.518994,
> -2.495409, -2.476031, -2.459662, -2.445513, -2.433014, -2.421739, -2.411344,
> -2.401536, -2.392040, -2.382571, -2.372786, -2.362198, -2.349891)
> upper<- c(2.311539, 2.372006, 2.423280, 2.469220, 2.511851, 2.552421,
>   2.591797, 2.630657, 2.669579, 2.709135, 2.749928, 2.792670, 2.838268,
>   2.887976, 2.943683, 3.008502, 3.088240, 3.195954, 3.373528)
>
> library(plotrix)
> plotCI(xx,ui=upper,li=lower,err="y",pch=NA, xlab="", ylab="", ylim=c(-5,
> 5),  slty="solid",scol="blue", lwd=2)
>
>
> My question is how can I change the xllim to be c(0,1) which corresponds to
> the "xx" values.
>
>         Hanna
> 2013/2/1 Ista Zahn<istazahn at gmail.com>
>
>> There are many plotCI functions in many different packages... which
>> one are you referring to? Also please construct a reproducible example
>> illustrating your problem.
>>
>> Best,
>> Ista
>>
>> On Thu, Jan 31, 2013 at 11:58 PM, li li<hannah.hlx at gmail.com>  wrote:
>>> Hi all,
>>>     In my plotCI function, the argument x is chosen to be seq(0.05, 0.95,
>>> by=0.05).
>>> However, when I make the plot, the plot has the x coordinate goes  1:19.
>>>     Does anyone know how to make the x coordinate to be (0,0.5, 0.1, ...,
>>> 0.95).

Hi Hanna,
You are getting what you request in the example. xx is interpreted as 
the "y" values and the "x" values default to the number of "y" values 
(1:19). Perhaps what you want is something like this:

x<-seq(0.05,0.95,by=0.05)
xx<-seq(0.05,0.95,by=0.05)
lower<-c(-2.896865,-2.728416,-2.642574,-2.587724,-2.548672,-2.518994,
  -2.495409,-2.476031,-2.459662,-2.445513,-2.433014,-2.421739,-2.411344,
  -2.401536, -2.392040, -2.382571, -2.372786, -2.362198, -2.349891)
upper<-c(2.311539,2.372006,2.423280,2.469220,2.511851,2.552421,
  2.591797, 2.630657, 2.669579, 2.709135, 2.749928, 2.792670, 2.838268,
  2.887976, 2.943683, 3.008502, 3.088240, 3.195954, 3.373528)
library(plotrix)
plotCI(x,xx,ui=upper,li=lower,err="y",pch=NA,xlab="",ylab="",
  slty="solid",scol="blue",lwd=2)

Jim



More information about the R-help mailing list