| hd_venn_df | R Documentation |
A single-call convenience wrapper that accepts the same tidy data frame as
venn_df_to_list() and returns either an hd_spec_venn object (for the
declarative API) or an hd_geom layer (for the composable + API),
depending on the output argument.
hd_venn_df(
df,
output = c("spec", "geom"),
series_name = "Venn Diagram",
label_font_size = "14px",
value_suffix = "",
use_names = FALSE,
show_legend = FALSE
)
df |
A data frame with columns |
output |
Character. |
series_name |
Character. Passed to |
label_font_size |
Character. Passed to |
value_suffix |
Character. Passed to |
use_names |
Logical. Passed to |
show_legend |
Logical. Passed to |
This means you never need to call venn_df_to_list(), hd_spec_venn(),
or hd_geom_venn() directly when starting from a data frame.
An hd_spec_venn object when output = "spec", or an hd_geom
object when output = "geom".
output = "spec" (default)Returns an hd_spec_venn object.
Pass to hd_make() just like any other spec. Best for reporting
pipelines and scripts that separate data from presentation.
output = "geom"Returns an hd_geom layer. Add to an hd()
object with +. Best for interactive exploration and inline charts.
df <- data.frame(
type = c("set", "set", "intersect"),
id = c("A", "B", "A,B"),
name = c("Oslo", "Bergen", "Both"),
value = c(120, 95, 40)
)
spec_v <- hd_venn_df(df)
hd_make(spec_v, "venn", hd_opts(title = "City overlap"))
hd(mode = "dynamic") + hd_venn_df(df, output = "geom") + hd_opts(title = "City overlap")
venn_df_to_list(), hd_spec_venn(), hd_geom_venn(),
hd_make(), hd()
df <- data.frame(
type = c("set", "set", "intersect"),
id = c("A", "B", "A,B"),
name = c("Oslo", "Bergen", "Both"),
value = c(120, 95, 40)
)
# Declarative API
spec_v <- hd_venn_df(df)
hd_make(spec_v, "venn", hd_opts(title = "City overlap"))
# Composable API
hd(mode = "dynamic") +
hd_venn_df(df, output = "geom") +
hd_opts(title = "City overlap")
# static mode
hd(mode = "static") +
hd_venn_df(df, output = "geom") +
hd_opts(title = "City overlap")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.