assemble_venndir_label | R Documentation |
Assemble grid grobs into venndir labels
assemble_venndir_label(
x = NULL,
y = NULL,
just = c("center", "center"),
signed_labels = NULL,
count_labels = NULL,
overlap_labels = NULL,
template = c("wide", "tall"),
fontfamily = "Helvetica",
fontfamilies = list(signed = fontfamily, count = fontfamily, overlap = fontfamily),
fontsizes = list(signed = 12, count = c(16, 12), overlap = 16),
fontfaces = list(signed = "plain", count = c("plain", "bold.italic"), overlap = "bold"),
fontcolors = list(signed = c("red3", "dodgerblue3", "grey55"), count = "black", overlap
= "black"),
label_borders = list(signed = grid::unit(1, "mm"), count = grid::unit(2, "mm"), overlap
= grid::unit(3, "mm")),
do_frame = TRUE,
frame_r = grid::unit(0.1, "snpc"),
frame_border = "#44444477",
frame_fill = "#FDDD6644",
text_grob_type = c("textGrob", "marquee", "richtext_grob"),
debug = FALSE,
verbose = FALSE,
...
)
x , y |
|
just |
|
signed_labels , count_labels , overlap_labels |
|
template |
|
fontfamily |
|
fontfamilies , fontsizes , fontfaces , fontcolors , label_borders |
|
do_frame |
|
frame_r |
|
frame_border , frame_fill |
|
text_grob_type |
|
debug |
|
verbose |
|
... |
additional arguments are ignored. |
Grobs are defined by signed_labels
, count_labels
, and overlap_labels
,
or when any argument is NULL
the label is skipped.
The labels are assembled with the following rules:
For each of the labels, when multiple values are provided, they are stacked on top of each other.
For signed_labels
, they are left-justified when template="wide"
,
otherwise they and all other labels are center-justified.
When both count_labels
and signed_labels
are defined, they
are combined according to template
:
template="wide"
: combines count_labels
on the left, and
signed_labels
on the right. They are center/middle-justified
relative to each other, in terms of height.
template="tall"
: combines count_labels
on the top, and
signed_labels
on the bottom.
The combined labels of count_labels
and/or signed_labels
are arranged center-justified underneath overlap_labels
,
when overlap_labels
is defined.
For each label, the font settings are applied in order, or recycled
to the vector length. For example if signed_labels
contains three
values, then fontsizes$signed
is recycled to length 3, and applied
to each label in order.
fontsizes
: applies to each label in order
fontfamilies
: by default uses fontfamily
for all labels, but
permits any label to use a custom font
fontfaces
: applies fontface to each label in order, with recognized
values: "plain", "bold", "italic", "bold.italic"
fontcolors
: applies font color to each label in order
pdf.options(encoding="ISOLatin1.enc")
vl <- assemble_venndir_label(
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"),
debug="overlap")
pdf.options(encoding="ISOLatin2.enc")
vl <- assemble_venndir_label(
overlap_labels=c("\u2191\u2191 15",
"\u2193\u2193 23")[1],
debug="overlap")
vl2 <- assemble_venndir_label(
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"),
count_labels=c("38"),
debug="overlap")
vl3 <- assemble_venndir_label(
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"),
count_labels=c("38"),
overlap_labels="Set Name Goes Here",
debug="overlap")
vl4 <- assemble_venndir_label(template="wide",
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"),
count_labels=c("38", "12%"),
overlap_labels="Set Name Goes Here",
debug="overlap")
vl5 <- assemble_venndir_label(
signed_labels=c("\u2191\u2191 15",
"\u2191\u2193 8",
"\u2193\u2193 23"),
fontcolors=list(signed=c("red3", "darkorchid", "dodgerblue3")),
count_labels=c("46", "12%"),
overlap_labels="Set Name Goes Here",
debug="overlap")
vl6 <- assemble_venndir_label(
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"),
#count_labels=c("38", "12%"),
overlap_labels="Set Name Goes Here",
debug="overlap")
# example preparing multiple labels, one at a time
vlxy1 <- assemble_venndir_label(fontfamily="Times",
just="right",
x=grid::unit(0.25, "snpc"), grid::unit(0.5, "snpc"),
count_labels=c("138"),
signed_labels=c("\u2191\u2191 15",
"\u2193\u2193 23"))
vlxy2 <- assemble_venndir_label(template="wide",
just=c("right", "top"),
x=grid::unit(0.25, "snpc"), grid::unit(0.25, "snpc"),
count_labels=c("101", "24%"),
signed_labels=c("\u2191\u2191 27",
"\u2193\u2193 74"))
# each label can be drawn individually, or combined into gList (below)
new_gtree <- grid::gTree(children=grid::gList(
vlxy1, vlxy2))
grid::grid.newpage();
grid::grid.draw(new_gtree);
grid::grid.points(x=grid::unit(c(0.25, 0.25), "snpc"),
y=grid::unit(c(0.50, 0.25), "snpc"),
pch=3,
gp=grid::gpar(cex=0.8, lwd=2, col="darkorange"));
pdf.options(encoding="ISOLatin1.enc")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.