[R] Breaks in y-axis of histogram using lattice

John Poulsen jpoulsen at zoo.ufl.edu
Sat Mar 28 14:15:08 CET 2009

Hello R-Users,

I am plotting several histograms to demonstrate zero-inflated data using 
lattice.  Because there are so many zeros, it is difficult to see the 
observations of non-zeros on the graph (i.e. the y-axis scale is too 
large).  I would like to break the y-scale so that the non-zeros at 
least show up on the graph.  Below is an example of the code for the 
histogram (e.g. I have several panels), how could I include breaks in 
the y-axis for some panels and not others?

Thanks for your help,

cts<-data.frame(no=c(rpois(50,20), rpois(50,2)), lab=rep(c(1,2), each=50))
histogram(~no|factor(lab), data=cts, type="count", breaks=10)

More information about the R-help mailing list