Draw boundary around groups of gridtext labels

draw_gridtext_groups(
  g_labels,
  gdf,
  groupdf = NULL,
  segment_df = NULL,
  realign = TRUE,
  adjust_center = FALSE,
  template = c("wide", "tall"),
  adjx_fn = c,
  adjy_fn = c,
  do_draw = TRUE,
  verbose = FALSE,
  ...
)

Arguments

g_labels

richtext_grob class as returned by gridtext::richtext_grob().

gdf

data.frame with one row per grob in g_labels, with colnames "x", "y", "overlap_set", "r", "r_unit", "border_col", "box_fill". The rows are grouped using c("x", "y", "overlap_set"). The "r" and "r_unit" values are used to define the radius and radius unit for the rounded corner. The row in gdf with the highest "r" value is the reference row, for the "r" radius, and the "border_col" and "box_fill" values.

groupdf

data.frame with information about label groupings, with columns: overlap_set, counttype, type, location, roworder, label_df_rowname, name, childName, gdf_group. Importantly, it must be in identical row order as gdf.

segment_df

data.frame with segment coordinates, optional.

realign

logical experimental feature (now default) indicating whether to realign grouped labels, thus ignoring the hjust/vjust for each label, instead arranging the labels using groupdf. In principle, overlap label (set name) should be top-center, and counts should be centered below. When there are main counts and signed counts, they should be in two columns, collectively centered below the main label.

adjust_center

logical indicating whether to adjust the x-centering for a group of labels when adjx=0.5, using the total width of the group of labels. When FALSE (default) the label x-position is not adjusted, which assumes labels are already oriented properly with respect to the x-axis position. This option is FALSE specifically for two-column labels positioned around a fixed centerpoint, where one column could be wider than the other, and it would otherwise push the other column the other way.

template

character string (default "wide") with experimental layout templates for count and signed labels.

  • "wide" - original strategy with signed counts beside main counts.

  • "tall" - new strategy with main counts and signed counts in the same column.

do_draw

logical indicating whether to draw the finished result in the context of the current open graphics device.

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Details

This function is an internal function used to take individual labels defined by gridtext::richtext_grob(), and creating grid::roundrectGrob() objects that cover each group of labels with one rounded rectangular boundary.

See also

Other venndir label: reposition_venn_gridtext_labels()