[R] barplot with anchored bars
Uwe Ligges
ligges at statistik.tu-dortmund.de
Fri Aug 22 10:13:41 CEST 2008
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)
You have to set the "ylim" in that case.
If you read the barplot.default code, you will find that "rAdj" is some
adjustment value that can only be omitted by specifying ylim.
Uwe Ligges
>
> The parameter yaxs='i' does not seem to work with barplot.
>
> I use R version 2.7.1, running on Windows XP.
>
> Thank you very much.
>
> Paulo Barata
>
> --------------------------------------------------------------------
> Paulo Barata
> Fundacao Oswaldo Cruz - Oswaldo Cruz Foundation
> Rua Leopoldo Bulhoes 1480 - 8A
> 21041-210 Rio de Janeiro - RJ
> Brazil
>
> E-mail: pbarata at infolink.com.br
> Alternative e-mail: paulo.barata at ensp.fiocruz.br
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list