4.9 Nudge specific labels
Venndir automatically places labels which aims to cover the most common
85% scenarios. For all other cases, labels can be re-positioned using
nudge_venndir_label()
.
- For each overlap, the label can be displayed 'inside' or 'outside'.
- The position defined for 'inside' or 'outside' can be adjusted with
nudge_venndir_label()
.
As such, a label position is identified by two criteria:
- Overlap: each set name, separated by ampersand
'&'
, for example'set_A&set_B'
- Location: 'inside' or 'outside' the Venn diagram.
The components of each label, and placement 'inside' or 'outside',
are stored in the Venndir
object as described in Venndir Labels.
Individual changes can be made by following Customize Any Label.
Instead, nudge_venndir_label()
adjusts the coordinate position
used when placing each label 'inside' or 'outside'.
setlist <- make_venn_test(100, 3, do_signed=TRUE)
vo <- venndir(setlist,
overlap_type="each",
label_style="lite box",
main="Default venndir")
vo2 <- nudge_venndir_label(vo,
set="set_A&set_C",
label_location="inside",
x_offset=-0.04)
plot(vo2, main="'set_A&set_C' moved left")


Figure 4.12: Venndir example with default label placement (left), and with 'set_A&set_C'
moved to the left (right).
The changes were defined by these arguments:
- The overlap:
set="set_A&set_C"
- The location:
label_location="inside"
- The x position:
x_offset=-0.04
, with default units relative to the total size of the figure.
An alternative approach may be more convenient, using argument offset_list
.
The argument is a list
, named by overlap, containing a two-value
numeric
vector with the x,y offset values. This style is
more convenient when adjusting multiple labels together.
Note that label_location
is still required.
Figure 4.13 shows the effects after nudging
labels 'set_A&set_C'
and 'set_C'
in one step.
vo3 <- nudge_venndir_label(vo,
label_location="inside",
offset_list=list(
"set_A&set_C"=c(-0.04, -0.02),
"set_C"=c(0, 0.05)
))
plot(vo3, main="Two labels moved")

Figure 4.13: Venndir after moving labels 'set_A&set_C'
and 'set_C'
using offset_list
.