View source: R/create_hexagon.R
create_hexagon | R Documentation |
This function creates a hexagon polygon based on the provided pair of center coordinates, size, and top type.
create_hexagon(center_x, center_y, size, top_type)
center_x |
The x-coordinate of the hexagon center. |
center_y |
The y-coordinate of the hexagon center. |
size |
The size of the hexagon. It should be based on projection of input data |
top_type |
The type of the hexagon top, either "flat" or "pointy". |
An 'sf' polygon representing the created hexagon.
# Create a flat-topped hexagon with center coordinates (419093.9, 3149336) and size 5km
flat_top <- create_hexagon(419093.9, 3149336, 50000, "flat")
# plot
plot((flat_top))
# create a pointy-topped hexagon with same arguments
pointy_top <- create_hexagon(419093.9, 3149336, 50000, "pointy")
# plot(pointy_top)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.