Plots highest posterior density (HPD) uncertainty regions as filled polygons. By default, polygons are smoothed using kernel smoothing for visual appeal. Polygons are filled by age to match the temporal color scale of branches.

geom_phylo_hpd(
  mapping = NULL,
  data = NULL,
  alpha = 0.5,
  smooth = TRUE,
  smoothness = 1,
  ...
)

Arguments

mapping

Aesthetic mappings created with ggplot2::aes(). If NULL, uses default mapping: aes(x = lon, y = lat, group = group, fill = age).

data

A data.frame with HPD polygon data or a phylo_phylogeo object. Must contain columns: lon, lat, group, age.

alpha

Numeric transparency (0-1). Default 0.5.

smooth

Logical; apply kernel smoothing to polygons. Default TRUE. Set FALSE for faster rendering or when smoothing causes issues.

smoothness

Numeric smoothing intensity (default 1). Higher values produce smoother polygons but may distort small features.

...

Additional arguments passed to the underlying geom.

Value

A ggplot2 layer.

Examples

if (FALSE) { # \dontrun{
data(wnv_tree)
pgeo <- build_phylogeo(wnv_tree)
ggplot() + geom_phylo_hpd(data = pgeo$hpd, alpha = 0.3)
} # }