From ligges at statistik.uni-dortmund.de  Fri Sep 19 09:59:05 2003
From: ligges at statistik.uni-dortmund.de (ligges@statistik.uni-dortmund.de)
Date: Fri Sep 19 08:58:52 2003
Subject: [Rd] hist will not use parameter xaxs (PR#4219)
Message-ID: <200309190659.h8J6x5JH022570@pubhealth.ku.dk>

mwall@diversa.com wrote:

> Full_Name: Mark Wall
> Version: 1.6.0

Please don't submit bug reports for outdated versions of R.


> OS: linux
> Submission from: (NULL) (63.251.119.254)
> 
> 
> I want to plot a histogram of a *subset* of some data:
> 
> 
>>t = c(0:9)
>>hist(t,right=FALSE,breaks=10,xlim=c(0,5),xaxs="i")
 >
> 
> This means I should plot a histogram from 0 to 5 with breaks at 1,2,3,4.  This
> should produce exactly 5 bars of frequency=1.  Instead I get 5 and 1/4 bars.  I
> do not want the 4% margins on the x axis that xaxs="r" provides.

What documentation tells us that hist() accepts an argument "xaxs"? I 
cannot find any. Hence it is *not* a bug. You can use par() to set 
parameters like this.


What you can do is:

  dat <- 0:9
  par(xaxs = "i")
  hist(dat, right = FALSE, xlim = c(0, 5), breaks = 10)

or subset your data itself:

  hist(t[t<5], right = FALSE, breaks=0:5)

Uwe Ligges


[Rd] hist will not use parameter xaxs (PR#4219)
ligges@statistik.uni-dortmund.de