[R] barplot

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Dec 8 16:59:00 CET 1999


"Zdenek Skala" <Zdenek.Skala at incoma.cz> writes:

> Dear all,
> do anybody know how to set ylim in barplot() correctly? When I 
> write:
> > barplot(c(.1,.5,1.0))
> the y-axis goes from 0.0 to 0.8. Wheny I type:
> > barplot(c(.1,.5,1.0,),ylim=range(0:1))
> the y-axis goes from 0.0 to 0.8.

0.2 to 0.8, no?

> Obviously I am doing something wrong. Are the ylim setting 
> standards in barplot() other than in plot() or is this a bug?
> Thanks for any hints!
> Zdenek

Yes, and yes. The axis settings use yaxs='i' (or xaxs if horizontal)
which sets the plot boundaries equal to the ylim (stated or computed)
and marks the axes "internally". The endpoints of the axes are not
considered to be internal (this is the bug, they are in Splus).

Quick workaround is: 

barplot(c(.1,.5,1.0),ylim=range(-.01,1.01))

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list