hex_pos: Find centre of closest hexagon.

Description Usage Arguments Value Examples

Description

Find centre of closest hexagon.

Usage

1

Arguments

x

numeric x position

y

numeric y position

width

of hexagon

height

of hexagon

Value

matrix giving position of closest hexagon center

Examples

1
2
3
4
5
6
x <- runif(1e4)
y <- runif(1e4)
res <- hex_pos(x, y, 0.5, 0.5)
plot(x, y, type = "n")
segments(x, y, res[, 1], res[, 2], col = "grey80")
points(unique(res), pch = 20, cex = 2)

hadley/densityvis documentation built on May 17, 2019, 9:56 a.m.