[R] default borders in boxplot and barplot

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Oct 14 11:40:58 CEST 2009


On Wed, Oct 14, 2009 at 2:21 AM, Jennifer Young
<Jennifer.Young at math.mcmaster.ca> wrote:
> This is my first post so hopefully I haven't mucked up the rules.
>
> I'm trying to change the default borders in either boxplot or barplot so
> that, at the request of a journal, all of my figures have the same type of
> border.
>
> I've successfully used par(bty="o")  using plot(1:10, bty="o"), but it
> seems that barplot and boxplot have their own defaults that override this.
>
> I've tried both
> par( bty="o")
> barplot(stuff)
>
> and
>
> barplot(stuff, bty="o")
>
>
> Does anyone know a trick that doesn't involve using abline() to force
> borders?
>

 Just do box() to draw a box round your plot area? Using the example
from ?barplot

 > require(grDevices) # for colours
 >      tN <- table(Ni <- stats::rpois(100, lambda=5))
 >      r <- barplot(tN, col=rainbow(20))
 > box()

Barry




More information about the R-help mailing list