2次元ヒストグラム3
hist2db<-function(x,y,kugirix,kugiriy){ sx<-kugirix[1:(length(kugirix)-1)] sy<-kugiriy[1:(length(kugiriy)-1)] fx<-kugirix[2:(length(kugirix))] fy<-kugiriy[2:(length(kugiriy))] boxf<-function(x){ j1<-max(which(sx<x)) } counts<-0 i1<-0 i2<-0 j1<-0 j2<-0 sur<-0 density<-0 k<-1 mat<-matrix(0,length(sy),length(sx)) matc<-matrix(0,length(sy),length(sx)) x2<-x; y2<-y; for(i in 1:length(x)){ ly<-max(which(x[i]>=sy)) lx<-max(which(y[i]>=sx )) matc[ly,lx]<-matc[ly,lx]+1; #mat[i,j]<-counts[k] #cat(i/length(x),"\n") } #density<-density/length(matc) mat<-matc/length(matc) #mat list(data.frame(sx,sy),data.frame(fx,fy),matc,mat) #image(sort(unique(t[[1]][,3])),sort(unique(t[[1]][,1])),log(t[[3]]),log="xy") } #x<-rnorm(1000) #y<-rnorm(1000) #a<-read.csv("100000_r10.dat") #dy<-1.5^(0:51) #dx<-1.5^(0:19) #dy<-1.2^(0:71) #dx<-1.2^(0:27) #dy<-1.2^(0:130) #dx<-1.2^(0:49) dy<-2^(0:18) dx<-2^(0:18) x<-d2[,1] y<-d2[,2] t<-hist2db(y,x,dy,dx) #image(log(t[[2]])) image(sort(unique(t[[1]][,2])),sort(unique(t[[1]][,1])), log(t[[4]]) , log="xy" )