[R] barplot with anchored bars

Jim Lemon jim at bitwrit.com.au
Fri Aug 22 13:59:46 CEST 2008


On Thu, 2008-08-21 at 15:47 -0300, Paulo Barata wrote:
> Dear R list members,
> 
> How to produce barplots anchored to the x-axis (not floating
> above the x-axis) with a box around?
> 
> With both following codes, the lower horizontal line of the
> box is below the y = 0 line:
> 
> # first code
> x <- c(1,2,3,4)
> barplot(x,yaxs='i')
> box()
> 
> # second code
> x <- c(1,2,3,4)
> op <- par(yaxs='i')
> barplot(x)
> box()
> par(op)
> 
> The parameter yaxs='i' does not seem to work with barplot.
> 
> I use R version 2.7.1, running on Windows XP.
> 
Hi Paolo,
Have a look at the barp function in the plotrix package.

Jim



More information about the R-help mailing list