Displaying 1 result from an estimated 1 matches for "binscatt".
Did you mean:
bindcat
2006 Feb 06
2
panel.levelplot() for 2D histograms
...rk-around, but I prefer to do it the elegant way
here's an example of what I want, what I tried and where it goes wrong:
require(gregmisc)
require(lattice)
#toy dataset:
ds<-data.frame(x=rnorm(3000),y=rnorm(3000),group=rep(factor(c("A","B","C")),
1000))
# this binscatter-function shows what I want,
# I just would like to have it as a panel function
binscatter<-function(x,y){
col<-rev(gray.colors(5))
breaks=c(1,5,10,100,500,100000)
h2d<-hist2d(x=x,y=y,nbins=10,same.scale=T,show=F)
image(h2d$x,h2d$y,h2d$counts,breaks=breaks,col=col,axes=T)
}
# for o...