Render venndir output

render_venndir(
  venndir_output = NULL,
  expand_fraction = 0,
  font_cex = 1,
  item_cex = NULL,
  item_cex_factor = 4,
  plot_warning = TRUE,
  show_labels = NULL,
  show_items = c(NA, "none", "sign item", "item", "sign"),
  item_degrees = 0,
  max_items = 100,
  show_zero = TRUE,
  show_segments = TRUE,
  segment_buffer = -0.1,
  label_preset = c("none"),
  label_style = c("custom", "basic", "fill", "shaded", "shaded_box", "lite", "lite_box"),
  fontfamily = "Arial",
  inside_percent_threshold = 0,
  item_style = c("default", "text", "gridtext"),
  item_buffer = -0.15,
  group_labels = TRUE,
  adjust_center = FALSE,
  draw_legend = TRUE,
  legend_x = "bottomright",
  legend_font_cex = 1,
  show_label = NA,
  display_counts = TRUE,
  do_newpage = TRUE,
  do_draw = TRUE,
  draw_buffer = FALSE,
  ...
)

Arguments

venndir_output

Venndir output from venndir(), or list with element "vo" as a Venndir object.

expand_fraction

numeric value indicating how much to expand the figure range beyond the default calculated for the Venn diagram. Values above zero cause the Venn diagram to be slighly smaller.

font_cex

numeric scalar to adjust font sizes.

item_cex

numeric scalar applied to item labels in each overlap in order. When length(item_cex) == 1 it is applied uniformly across all overlaps, otherwise it is recycled to the total number of overlaps. When provided, it is used instead of any adjustments to item label sizes based upon proportional area of each overlap.

item_cex_factor

numeric value used to adjust pre-calculated item fontsizes. This value is used to adjust the item label sizes, which may also be adjusted proportional to the area of each overlap, in which case item_cex_factor is used to adjust those relative label sizes.

plot_warning

logical indicating whether to include a warning when one or more non-zero overlap counts cannot be displayed in the figure. Not yet re-implemented since version 0.0.30.900.

show_labels

character string to define the labels to display, and where they should be displayed. The definition uses a single letter to indicate each type of label to display, using UPPERCASE to display the label outside the Venn shape, and lowercase to display the label inside the Venn shape. The default "Ncs" displays _N_ame (outside), _c_ount (inside), and _s_igned count (inside).

The label types are defined below:

  • _N_ame: "n" or "N" - the set name, by default it is displayed.

  • _O_verlap: "o" or "O" - the overlap name, by default it is hidden, because these labels can be very long, also the overlap should be evident in the Venn diagram already.

  • _c_ount: "c" or "C" - overlap count, independent of the sign

  • _p_ercentage: "p" or "P" - overlap percentage, by default hidden, but available as an option

  • _s_igned count: "s" or "S" - the signed overlap count, tabulated based upon overlap_type ("each", "concordant", "agreement", etc/)

  • _i_tems: "i" only, by default hidden. When enabled, item labels defined by show_items are spread across the specific Venn overlap region.

show_items

character used to define the item label, only used when the show_label entry includes "i" which enables item display inside the Venn diagram.

  • "item": shows only the item labels

  • "sign": shows only the sign of each item

  • "sign items": shows the sign and item together (or "item sign" will show the item, then the sign).

item_degrees

numeric angle (default 0) in degrees used to adjust item label display.

max_items

numeric (default 3000) indicating the maximum number of item labels to display when enabled.

show_zero

logical (default FALSE) indicating whether empty overlaps are labeled with count zero 0. When show_zero=TRUE the count zero label is displayed, otherwise no count label is shown.

show_segments

logical (default TRUE) indicating whether to draw a line segment from the Venn region to any label positioned outside.

segment_buffer

numeric (default -0.1) indicating the depth inside each Venn region a line segment will be drawn, relevant only when show_segments=TRUE.

label_preset

character deprecated in favor of show_labels. This argument is passed to venndir_label_style().

label_style

character string indicating the style for labels. Label color is adjusted based upon the determined background color, determined based upon the label fill color, and either the device background color, or Venn overlap fill color. There are pre-defined label styles.

  • "basic" no background shading

  • "fill" an opaque colored background

  • "shaded" a partially transparent colored background

  • "lite" a partially transparent lite background

  • "box" adds a dark border around the label region

fontfamily

character font family

inside_percent_threshold

numeric (default 0) indicating the percent area that a Venn overlap region must contain in order for the count label to be displayed inside the region, otherwise the label is displayed outside the region. Values are expected to range from 0 to 100.

item_style

character string (default "text") indicating the style to display item labels when they are enabled.

  • "default" detects whether item labels contain "<br>" for newlines, and uses "gridtext" if that is the case, otherwise it uses "text" which is markedly faster.

  • "text" option is substantially faster, but does not allow markdown.

  • "gridtext": substantially slower for a large number of labels, but enables use of limited markdown by calling gridtext::richtext_grob(). Mostly useful for venn_meme().

item_buffer

numeric value (default -0.15) indicating the buffer adjustment applied to Venn overlap regions before arranging item labels. Passed to label_fill_JamPolygon() via render_venndir(). Negative values are recommended, so they shrink the region.

group_labels

logical (default TRUE) indicating whether to group label components together, therefore drawing fill and border around the group instead of each component. In most cases this setting should be TRUE.

adjust_center

logical (default TRUE) used when labels are grouped, whether the group should be re-centered on the target point. Try adjust_center=FALSE if wide label groups are adjusted so that the count label is too far left.

draw_legend

logical (default TRUE) indicating whether to draw a legend, calling venndir_legender().

legend_x

character passed to venndir_legender() to customize the position of the legend.

legend_font_cex

numeric scalar to adjust the legend font size.

do_newpage

logical (default TRUE) indicating whether to call grid::grid.newpage(). This option allows the figure to be rendered inside an active display device, or active grid::viewport. Note: When do_draw=FALSE, it also forces do_newpage=FALSE.

do_draw

logical indicating whether to call grid::grid.draw(). The grid graphical objects are returned in attributes: "gtree", "grob_list", "viewport", and can be drawn separately.

...

additional arguments are passed to render_venndir().

Value

Venndir object with attributes that contain underlying grid graphical objects (grobs):

  • "gtree": a grid::gTree object suitable for drawing with grid::grid.draw(attr(vo, "gtre"))

  • "grob_list": a list of grid object components used to build the complete diagram, they can be plotted individually, or assembled with do.call(grid::gList, grob_list). The grid::gList can be assembled into a gTree with: grid::grobTree(gList=do.call(grid::gList, grob_list)

  • "viewport": the grid::viewport that holds important context for the graphical objects, specifically the use of coordinate grid::unit measure "snpc", which maintains a fixed aspect ratio.

See also

Other venndir core: signed_overlaps(), textvenn(), venn_meme(), venndir()