|
101 | 101 | } |
102 | 102 |
|
103 | 103 | .trihexgrid = function(xlim=c(0,100), ylim=c(0,100), step=c(1,1), direction='h'){ |
104 | | - # if(direction=='h'){ |
105 | | - # xvec1 = seq(xlim[1], xlim[2]+step[1], by=step[1]) |
106 | | - # xvec2 = seq(xlim[1], xlim[2]+step[1]/2, by=step[1]) |
107 | | - # |
108 | | - # yvec1 = seq(ylim[1], ylim[2]+step[2]*0.8660254, by=2*step[2]*0.8660254) |
109 | | - # yvec2 = seq(ylim[1]+step[2]*0.2886751-step[2]*0.8660254, ylim[2]-step[2]*0.2886751+step[2]*0.8660254, by=2*step[2]*0.8660254) |
110 | | - # |
111 | | - # grid1 = expand.grid(x=xvec1, y=yvec1) |
112 | | - # grid2 = expand.grid(x=xvec2, y=yvec2) |
113 | | - # grid3 = expand.grid(x=xvec1-step[1]/2, y=yvec1-step[2]*0.8660254) |
114 | | - # grid4 = expand.grid(x=xvec2-step[1]/2, y=yvec2-step[2]*0.8660254) |
115 | | - # } |
116 | | - # if(direction=='v'){ |
117 | | - # xvec1 = seq(xlim[1], xlim[2]+step[1]*0.8660254, by=2*step[1]*0.8660254) |
118 | | - # xvec2 = seq(xlim[1]+step[1]*0.2886751-step[1]*0.8660254, xlim[2]-step[1]*0.2886751+step[1]*0.8660254, by=2*step[1]*0.8660254) |
119 | | - # |
120 | | - # yvec1 = seq(ylim[1], ylim[2]+step[2], by=step[2]) |
121 | | - # yvec2 = seq(ylim[1], ylim[2]+step[2]/2, by=step[2]) |
122 | | - # |
123 | | - # grid1 = expand.grid(x=xvec1, y=yvec1) |
124 | | - # grid2 = expand.grid(x=xvec2, y=yvec2) |
125 | | - # grid3 = expand.grid(x=xvec1-step[1]*0.8660254, y=yvec1-step[2]/2) |
126 | | - # grid4 = expand.grid(x=xvec2-step[1]*0.8660254, y=yvec2-step[2]/2) |
127 | | - # } |
128 | | - # return(rbind(cbind(grid1, type=1), cbind(grid2,type=2), cbind(grid3, type=1), cbind(grid4, type=2))) |
129 | 104 | .trigrid(xlim=xlim, ylim=ylim, step=step, direction=direction, offset=0.5) |
130 | 105 | } |
131 | 106 |
|
|
306 | 281 | output = list(bins=data.frame(grid, count=bincount, zstat=binzstat), dust=dust, groups=groups, |
307 | 282 | xlim=xlim, ylim=ylim, step=step, dustlim=dustlim, shape=shape, direction=direction, use=use) |
308 | 283 | class(output) = 'magbin' |
309 | | - return(output) |
| 284 | + gc() #this seems to be need, not sure why! |
| 285 | + return(invisible(output)) |
310 | 286 | } |
311 | 287 |
|
312 | 288 | plot.magbin = function(x, colramp=hcl.colors(21), colstretch='lin', sizestretch='lin', |
@@ -532,6 +508,7 @@ magbin = function(x, y, z=NULL, xsup=NULL, ysup=NULL, xlim=NULL, ylim=NULL, zlim |
532 | 508 | ydata=y, locut=locut, hicut=hicut, type=type, ...) |
533 | 509 | } |
534 | 510 | } |
| 511 | + gc() #this seems to be need, not sure why! |
535 | 512 | return(invisible(bincount)) |
536 | 513 | } |
537 | 514 |
|
|
0 commit comments