| +.hd | R Documentation |
Implements the + operator for hd() objects, mirroring how ggplot2
builds plots incrementally. Recognised right-hand sides:
## S3 method for class 'hd'
e1 + e2
e1 |
An |
e2 |
An |
hd_geom objectSets the geometry (from any hd_geom_*() call).
Adding a second geom replaces the first where highdir renders one geometry
per figure.
hd_opts objectSets presentation options. Adding a second
hd_opts replaces the first.
Unknown right-hand sides produce an informative error rather than silently being ignored.
The updated hd object (invisibly, so the chain prints once).
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.