A large intersection size can be driven by a large number of members in a group; to account for that, one can divide the intersection size by the size of a union of the same groups. This cannot be calculated for the null intersection (observations which do not belong to either of the groups).

intersection_ratio(
  mapping = aes(),
  counts = TRUE,
  bar_number_threshold = 0.75,
  text_colors = c(on_background = "black", on_bar = "white"),
  text = list(),
  text_mapping = aes(),
  mode = "distinct",
  denominator_mode = "union",
  width = 0.9,
  ...
)

Arguments

mapping

additional aesthetics for geom_bar()

counts

whether to display count number labels above the bars

bar_number_threshold

if less than one, labels for bars height greater than this threshold will be placed on (not above) the bars

text_colors

a name vector of characters specifying the color when on_background and on_bar (see bar_number_threshold)

text

additional parameters passed to geom_text()

text_mapping

additional aesthetics for geom_text()

mode

region selection mode, defines which intersection regions will be accounted for when computing the size. See get_size_mode() for accepted values.

denominator_mode

region selection mode for computing the denominator in ratio. See get_size_mode() for accepted values.

width

bar width, by default set to 90%

...

Arguments passed on to intersection_size

position

position passed to geom_bar()