From ihaka at stat.auckland.ac.nz  Fri Sep 26 16:32:15 2003
From: ihaka at stat.auckland.ac.nz (Ross Ihaka)
Date: Fri Sep 26 05:31:44 2003
Subject: [Rd] hist will not use parameter xaxs (PR#4219)
References: <200309182035.h8IKZeJH019875@pubhealth.ku.dk>
Message-ID: <3F73B33F.6010509@stat.auckland.ac.nz>

mwall@diversa.com wrote:
> Full_Name: Mark Wall
> Version: 1.6.0
> 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.

This is still a problem.

xlim applies to the graph of the histogram, not the histogram itself.
You need to subset your before plotting.  Try:

hist(t[0<=t & t<=5], right=FALSE,breaks=10,xlim=c(0,5),xaxs="i")


-- 
Ross Ihaka                         Email:  ihaka@stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 85054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand


[Rd] hist will not use parameter xaxs (PR#4219)
Ross Ihaka