[R] Turn off border on barplot

Marc Schwartz MSchwartz at mn.rr.com
Thu Oct 26 23:50:28 CEST 2006


On Fri, 2006-10-27 at 10:00 +1300, Paul Murrell wrote:
> Hi
> 
> 
> Marc Schwartz wrote:
> > On Thu, 2006-10-26 at 16:13 -0400, Frank McCown wrote:
> >> I was wondering if there was any way to completely remove the borders 
> >> around each bar when using the barplot function.  I understand how to 
> >> change the color of the border (border="white"), but I need the border 
> >> to be invisible so I can plot many skinny bars right next to each other 
> >> with only the bar's color visible.
> >>
> >> Thanks,
> >> Frank
> > 
> > You can try:
> > 
> >  # Set line type to blank
> >  # See ?par
> >  # First save current value
> >  lty.o <- par("lty")
> > 
> >  par(lty = 0)
> > 
> >  # Also set space to 0, rather
> >  # than default 0.2, if needed for more room
> >  barplot(1:10, space = 0)
> > 
> >  # Reset to old value
> >  par(lty = lty.o)
> 
> 
> or ...
> 
> barplot(1:10, border=NA)
> 
> Paul

Yep, that'll do it too...  :-)

Thanks Paul. I had forgotten about that.

The only place that particular behavior seems documented is in ?par in
the "Color Specification" section. Does it make sense to add that to
relevant See Also's?

Best regards,

Marc



More information about the R-help mailing list