| plot,HexData,missing-method | R Documentation |
Default plot method for HexData objects. Draws hexagonal grid cells with an optional basemap.
## S4 method for signature 'HexData,missing'
plot(
x,
y,
basemap = TRUE,
clip_basemap = TRUE,
basemap_fill = "gray90",
basemap_border = "gray50",
basemap_lwd = 0.5,
grid_fill = "#E69F00",
grid_border = "#5D4E37",
grid_lwd = 0.8,
grid_alpha = 0.7,
fill = NULL,
show_points = FALSE,
point_size = "auto",
point_color = "red",
crop = TRUE,
crop_expand = 0.1,
main = NULL,
...
)
x |
A HexData object from |
y |
Ignored (for S4 method compatibility) |
basemap |
Basemap specification:
|
clip_basemap |
Clip basemap to data extent (default TRUE). Clipping temporarily disables S2 spherical geometry to avoid edge-crossing errors. |
basemap_fill |
Fill color for basemap (default "gray90") |
basemap_border |
Border color for basemap (default "gray50") |
basemap_lwd |
Line width for basemap borders (default 0.5) |
grid_fill |
Fill color for grid cells (default "#E69F00" - amber/orange) |
grid_border |
Border color for grid cells (default "#5D4E37" - dark brown) |
grid_lwd |
Line width for cell borders (default 0.8) |
grid_alpha |
Transparency for cell fill (0-1, default 0.7) |
fill |
Column name for fill mapping (optional) |
show_points |
Show original points on top of cells (default FALSE). Points are jittered within their assigned hexagon. |
point_size |
Size of points. Can be:
|
point_color |
Color of points (default "red") |
crop |
Crop to data extent (default TRUE) |
crop_expand |
Expansion factor for crop (default 0.1) |
main |
Plot title |
... |
Additional arguments passed to base plot() |
This function generates polygon geometries for the cells present in the data and plots them. Polygons are computed on demand, not stored, to minimize memory usage.
Invisibly returns the HexData object
hexify_heatmap for ggplot2 plotting
df <- data.frame(lon = runif(50, -5, 5), lat = runif(50, 45, 50))
result <- hexify(df, lon = "lon", lat = "lat", area_km2 = 2000)
# Basic plot
plot(result, basemap = FALSE)
# With basemap and custom styling
plot(result, grid_fill = "lightblue", grid_border = "darkblue")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.