Skip to content

Breaks in y-axis of histogram using lattice

2 messages · John Poulsen, Jim Lemon

#
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,
John


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)
#
John Poulsen wrote:
Hi John,
gap.barplot in the plotrix package may do what you want.

Jim