[R] ylim problem in barplot

Ben Bolker bolker at ufl.edu
Thu Jan 5 15:06:33 CET 2006

Ben Bolker <bolker <at> ufl.edu> writes:

> Bliese, Paul D LTC USAMH <paul.bliese <at> us.army.mil> writes:
> > 
> > R Version 2.2.0
> > 
> > Platform:  Windows
> > 
> > When I use barplot but select a ylim value greater than zero, the graph
> > is distorted.  The bars extend below the bottom of the graph.
> >
>   The problem is that barplot() is really designed to work
> with zero-based data.  I don't know if the Powers That Be
> will say that "fixing" this would violate the spirit of
> barplot (although I see there is some code in barplot 
> that deals with figuring out the base of the rectangle
> in the logarithmic case, where 0 obviously doesn't work)

  hmm, replying to myself ...
  Now that I think about it, I don't know if the default behavior should
necessarily be to set the baseline at ylim[1] or xlim[1] ...  (i.e., you
can imagine setting ylim negative to allow more space
below the bars ... you could allow a "baseline" argument,
but this would then be ripe for abuse ...  perhaps this
discussion should move to r-devel, if anyone cares  ... )

More information about the R-help mailing list