Implements the + operator for hd() objects, mirroring how ggplot2
builds plots incrementally. Recognised right-hand sides:
Details
hd_geomobjectSets the geometry (from any
hd_geom_*()call). Adding a second geom replaces the first — highdir renders one geometry per figure.hd_optsobjectSets presentation options. Adding a second
hd_optsreplaces the first.
Unknown right-hand sides produce an informative error rather than silently being ignored.
Examples
df <- data.frame(age = c("18-24", "25-34"), pct = c(42, 55))
# Chain layers
p <- hd(df, x = "age", y = "pct") +
hd_geom_column() +
hd_opts(title = "Demo")
# Reuse a partial object with different opts
base <- hd(df, x = "age", y = "pct") + hd_geom_column()
base + hd_opts(title = "English title")
base + hd_opts(title = "Norsk tittel")
