hex_wd {ptools} | R Documentation |
Get width of hexagon given height
hex_wd(height)
height |
scaler |
For use with ggplot and geom_hex
binwidth arguments, which expects arguments in width/height. I want hexagons in maps to be a specific area. See this blog post for a specific use case with ggplot.
A scaler for the width
hex_area()
for estimating the area given side length
hex_dim()
for estimating width/height given area
area_check <- 1000
wh <- hex_dim(area_check^2) #e.g. a square kilometer if spatial units are in meters
area <- hex_area(wh[1]/2) #inverse operation
all.equal(area_check,sqrt(area))
wi <- hex_wd(wh[1])
all.equal(wh[2],wi)