venndir label style
Usage
venndir_label_style(
venndir_output,
show_labels = c("Nsc"),
label_preset = c("none", "main inside", "main outside", "outside", "all outside",
"concept", "meme", "items", "main items", "main count items", "custom"),
label_style = c("basic", "box", "fill", "fill_box", "shaded", "shaded_box", "lite",
"lite_box"),
lite = "#FFEEAABB",
bg = "white",
set = c("outside", "inside", "none"),
overlap = c("none", "inside", "outside"),
percent = c("none", "inside", "outside"),
count = c("inside", "outside", "ifneeded", "detect", "none"),
signed = c("inside", "outside", "ifneeded", "detect", "none"),
items = c("none", "inside"),
percent_delim = "<br>",
show_items = NULL,
max_items = 3000,
inside_percent_threshold = 0,
label_types = c("main", "signed"),
extra_styles = list(percent = c("***", "***")),
show_zero = TRUE,
sep = "&",
useGrey = 15,
verbose = FALSE,
...
)
Arguments
- show_labels
character
string to describe which count labels to display, and where. The presence of each letter enables each label, and UPPERCASE places the label outside the Venn diagram, while lowercase places the label inside. The default"Ncs"
displays _N_ame (outside), _c_ount (inside), and _s_igned count (inside). Whenoverlap_type="overlap"
then the signed label is hidden by default.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.
- label_preset
DEPRECATED in favor of
show_labels
.- label_style
character
string indicating the style of label to display. The values"basic","none","shaded","lite","fill"
style the label background fill, while presence of"box"
in the string will draw a border around the label:"basic"
or"none"
uses no background fill,"lite"
uses lite background fill,"fill"
uses opaque fill with the overlap set color,"shaded"
uses slightly transparent fill with overlap set color,"box"
displays border around the label.- lite
character
color used whenlabel_preset
contains"lite"
.- bg
character
color used as the background color of the figure, used with outside labels to determine whether the text should be light or dark for proper visual contrast.- set, overlap, percent, count, signed, items
DEPRECATED in favor of
show_labels
.- percent_delim
character
string used only when both count and percent labels are enabled, as a delimiter between the two labels. The default"<br>"
causes a newline, so the count and percent values are on separate lines. Another suggestion is": "
which separates the two values with semicolon on one line.- show_items
character
string for the item label content, used only when items are displayed.- max_items
numeric
maximum number of labels permitted when items are displayed. When there are too many items, the item label is suppressed.- inside_percent_threshold
numeric
size for each polygon below which labels are moved outside, for labels that would otherwise be displayed inside. Item labels are not affected by this setting. The threshold is calculated as a percent of the overall Venn diagram polygon area.- label_types
character
vector with one or more label types to be affected by this function. By default"count"
and"signed"
labels (all labels) are affected.- extra_styles
list
of two-element vectors, named by the type of label, defaultlist(percent=c("***", "***"))
will use"***"
before and after each percentage label. No other label types are supported.- show_zero
logical
indicating whether to display zero0
for empty overlaps for which the overlap polygon exists. Default FALSE hides the display of zeros.- sep
character
string used as delimiter between Venn set names. This value should generally not be changed.- useGrey
numeric
value used byjamba::setTextContrastColor()
to define an appropriate contrasting color which retains some color saturation, default 15. UseuseGrey=0
would cause black or white labels with no color saturation.- verbose
logical
indicating whether to print verbose output.- ...
additional arguments are passed to internal functions such as
make_color_contrast()
.
Details
This function applies a label style to venndir()
output,
overwriting the existing label style as necessary.
This function adjusts the label text color for contrast with
make_color_contrast()
, which is useful when positioning
the label on top of dark or bright colors. If the label
is positioned outside the sp
polygons, the text is assumed
to be on a white background, using argument bg
.