On 01/13/2012 11:09 PM, Lasse DSR-mail wrote:
Got problems with plotCI (plotrix)

I only want to plot the upper part of the error bar in my barplot

I had the exact same commands working two months ago

Now I wanted to change the legend and when I ran it again plotCI stopped
working.



To me it seems like there must some bug in R







library(plotrix)

library (graphics)



x = matrix(c( 13.75516276,            3.944604404,      15.02280537,

   80.27687015,    91.35282561,      81.8232087,

5.96796709,        3.625017815,      3.202591556), nrow=3,byrow=T)

yx=matrix(c( 2.5,7.5,12.5,3.5,8.5,13.5,4.5,9.5,14.5), nrow=3,byrow=T)

ste<-c(4.870993623,
1.139221564,2.70870722,5.789702998,2.770116512,5.4600946821,1.2926938771,1.2
881562951,1.996090108)





w<-c("grey","light grey","white")





r<-c("Leioproctus", "Lasioglossum","Bombus")

barplot(x,ylab="Relative abundance (%, +SE)",

    xlab="Land use",

    col=c("grey","light grey","white"), beside=TRUE,

    space=c(0,2),

    ylim=c(0,107),cex.lab="1.3" )

legend(x=3.5, y=108, box.lty=0, legend=r, fill=w)



box(bty='l' )

#original command, now not working #

plotCI(x=yx,y=x,uiw=ste,liw=NA, pch=NA_integer_, col="black",
lwd=1,add=TRUE)



## why is this following command working

plotCI(x=yx,y=x,uiw=NA, liw=ste,pch=NA_integer_, col="black",
lwd=1,add=TRUE)


Hi Lasse,
I can't help you immediately with plotCI, but I think I can get you out of trouble. When I wrote the dispersion function, I displayed an undefined dispersion (e.g. a variance with only one observation) as a line going off the plot. It is fairly simple to suppress this, as I have done in the attached revision, which will be in the next version of plotrix. I have added an argument "display.na" that is TRUE by default. If set to FALSE, NAs will not be displayed on the plot. The code below should do what you want.

library(plotrix)
source("dispersion.R")
xpos<-barp(x,ylab="Relative abundance (%, +SE)",xlab="Land use",
 col=c("grey","light grey","white"),ylim=c(0,107),names.arg=r)
dispersion(xpos,x,ulim=ste,llim=NA,display.na=FALSE)
legend(x=0.5, y=108, box.lty=0, legend=r, fill=w)

Jim
______________________________________________
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.

Reply via email to