grid_hex | R Documentation |
This function generates a hexagonal lattice of points within the given x and y limits, using a specified hexagon diameter. The diameter is 2 times the distance between adjacent x (and y) values, see examples.
grid_hex(xlim, ylim, d)
xlim |
A numeric vector of length 2 specifying the x-axis limits. |
ylim |
A numeric vector of length 2 specifying the y-axis limits. |
d |
A numeric value specifying the hexagon diameter. |
A data frame with two columns, x
and y
, containing the
coordinates of the hexagonal grid points.
xlim <- c(-1, 1)
ylim <- c(-1, 0)
grid <- grid_hex(xlim, ylim, .25)
head( grid )
str( grid )
plot( grid, asp = 1 )
diff(sort(unique(grid$x)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.