On 26-Dec-09 15:33:45, James Rome wrote:> histogram(~(Arrival4) | as.factor(Hour), type="count",
> breaks=16,ylab="Arrival Count",
> xlab="Arrival Rate/4",main="Friday EWR A22R D22L
Configiration",
> layout=c(6,4), par.strip.text=list(cex=0.7))
>
> Why do I get plots with different bar widths? See attached.
>
> Thanks,
> Jim Rome
Read the 'breaks' section under "Arguments:" in ?histogram
in the lattice package.
If you choose to use the default method:
breaks = seq_len(1 + nlevels(x)) - 0.5
when 'x' is a factor, and
breaks = do.breaks(endpoints, nint)
otherwise, or if you specify the numerical break-points explicitly,
as for instance in
breaks = (0:15)
then the same set of break-points will be used for each histogram
across all panels. If you use another specification, such as yours:
breaks=15
then:
"Other values of 'breaks' are possible, in which case they
affect the display in each panel differently."
which is what you are seeing. Compare the three histogram plots
from the following code:
X <- c(rnorm(100),rnorm(50,1.0,0.5),rnorm(25,-1.0,0.5),rnorm(10))
F <- factor(c(rep(0,100),rep(1,50),rep(2,25),rep(3,10)))
# The default:
histogram(~X | F)
# Your choice (number of breaks)
histogram(~X | F, breaks=10)
# Explicit specification of break-points:
histogram(~X | F, breaks=0.5*(-6:6))
Hoping this helps,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 26-Dec-09 Time: 18:28:32
------------------------------ XFMail ------------------------------