hexGrid(spBayes)
hexGrid()所属R语言包:spBayes
Generates a hexagon tessellation within a bounding box
生成一个六边形镶嵌在包围盒
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function generates a hexagon tessellation within a bounding box.
这个函数生成一个六边形镶嵌在包围盒。
用法----------Usage----------
hexGrid(nodes.per.layer, b.box, ...)
参数----------Arguments----------
参数:nodes.per.layer
the number of hexagons from min.x to max.x at min.y.
六边形的数量从min.xmax.xmin.y。
参数:b.box
the domain's bounding box defined with a vector of length four and elements ordered min.x, min.y, max.x, max.y.
域的定义与向量长度为4和元素的边界框下令min.x,min.y,max.x,max.y。
参数:...
currently no additional arguments.
目前没有任何额外的参数。
值----------Value----------
A list with the following tags:
下面的标签列表:
参数:hx.hy
a vector of length two that holds the height and width, respectively, between hexagon centroids.
保持的高度和宽度,分别六边形形心之间的向量的长度为二。
参数:layers
the number of hexagon layers within the domain.
内六角层域的数量。
参数:nodes.per.layer
the number of hexagons from min.x to max.x at min.y.
六边形的数量从min.xmax.xmin.y。
参数:hex.centroids
an nx2 matrix with rows corresponding the the x and y coordinates of the n hexagons within the domain.
nx2行相应的矩阵x和y的n六边形内的域名协调。
参数:hex.polygons
a list with 6x2 matrices which hold the hexagons' x and y vertices coordinates.
6x2矩阵持有的六边形x和y顶点坐标的列表。
(作者)----------Author(s)----------
Andrew O. Finley <a href="mailto:finleya@msu.edu">finleya@msu.edu</a>, <br>
Sudipto Banerjee <a href="mailto:baner009@umn.edu">baner009@umn.edu</a>
实例----------Examples----------
## Not run: [#不运行:]
##Define the bounding box and make the call[#定义边框和拨打检测]
b.box <- c(0,0,10,10)
out <- hexGrid(20, b.box)
##Plot using lapply[#图使用lapply]
par(mfrow=c(1,2))
plot(out$hex.centroids, pch=19, cex=0.5,
ylab="Northing", xlab="Easting")
lapply(out$hex.polygons, polygon, col="blue")
##Now color hexagons based on value[#颜色六边形基于价值]
my.col.ramp <- function(z){
zlim <- range(z)
zlen <- zlim[2]-zlim[1]+1
colorlut <- heat.colors(as.integer(zlen))
col <- colorlut[z-zlim[1]+1]
col
}
n <- nrow(out$hex.centroids)
col <- my.col.ramp(rnorm(n))
plot(out$hex.centroids, typ="n", ylab="", xlab="Easting")
for(i in 1:n){
polygon(out$hex.polygons[[i]], col=col[i], border=col[i])
}
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|