[R] barplot plotting problem

Jim Lemon bitwrit at ozemail.com.au
Sat Jan 18 11:27:03 CET 2003

Jeremy Butler wrote:
> Hi,
> Is there any equivalent of type="n" when constructing barplots which
> will still construct the axes (plot=F, as it says doesn' plot anything
> at all). Alternatively I tried setting col="white" and border="white"
> but the border command does not seem to be operational. True??
> Any other ideas? What I'm actually trying to do is construct vertical
> abline()'s _behind_ my plotted data. It seems to me that this requires
> axes construction then abline plotting then data plotting. Fine for
> plot() etc. but I don't seem to be able to manage it when barplotting.
> Is there some other way to do this that I'm missing?
This may help.

> xpos<-barplot(c(1.3,2.5,2,2,3.4))
> # there's probably a better way to clear the device...
> plot(1:10,type="n",axes=F,xlab="",ylab="")
> barplot(c(1.3,2.5,2,2,3.4),plot=F)
> abline(v=xpos)
> par(new=T)
> xpos<-barplot(c(1.3,2.5,2,2,3.4))
> par(new=F)


More information about the R-help mailing list