modify_venndir_overlap | R Documentation |
Modify Venndir visual components by overlap name
Highlight Venndir visual components by overlap name by calling
modify_venndir_overlap()
modify_venndir_overlap(
venndir_output,
overlap_set,
params = NULL,
reorder = FALSE,
debug = FALSE,
...
)
highlight_venndir_overlap(
venndir_output,
overlap_set,
innerborder = "gold",
innerborder.lwd = 2,
border = "red3",
border.lwd = 1,
outerborder = innerborder,
outerborder.lwd = 0,
fill = "yellow",
params = list(fill = fill, innerborder = innerborder, innerborder.lwd =
innerborder.lwd, border = border, outerborder = outerborder, outerborder.lwd =
outerborder.lwd),
reorder = TRUE,
...
)
venndir_output |
|
overlap_set |
|
params |
Other tips for customization
|
fill , innerborder , innerborder.lwd , border , border , lwd , outerborder , outerborder.lwd |
passed to |
bordercolor |
|
This function provides a convenient method to modify visual features
of Venndir
objects defined by overlap set. By "overlap set" it refers
to definitive sets, for example "set_A"
refers to elements in "set_A"
which are not also present in any other set in the Vennlist
.
Similarly "set_A&set_B"
refers to elements only present in both
"set_A"
and "set_B"
and no other set in the Vennlist
.
Venndir
object after making modifications to the overlap_set
.
Other venndir utility:
curate_venn_labels()
,
expand_range()
,
make_color_contrast()
,
make_venn_combn_df()
,
make_venn_test()
,
match_list()
,
nudge_venndir_label()
,
plot,Venndir,ANY-method
,
print_color_df()
,
shrink_df()
,
three_point_angle()
,
venndir_legender()
,
venndir_to_df()
testlist <- make_venn_test(n_sets=3, do_signed=TRUE);
vo2 <- venndir(testlist,
show_labels="Ncsp",
show_segments=FALSE,
main="Default Venndir");
vo2m <- modify_venndir_overlap(vo2,
overlap_set="set_A&set_B",
params=list(fill="darkorange", alpha=0.8,
innerborder="red", innerborder.lwd=3,
outerborder="red", outerborder.lwd=3,
fontsize=c(18, 13, 13, 13),
label.border="black",
label.padding=c(5, 1, 1, 1), label.r=c(5, 1, 1, 1),
label.color=c("darkorange4", "firebrick4", "dodgerblue4", "grey44"),
label.fill=jamba::alpha2col("gold", alpha=0.8)
));
render_venndir(vo2m, main="Highlighted overlap");
# nudge the label slightly higher
vo2mb <- nudge_venndir_label(vo2m,set="set_A&set_B",
x_offset=-0.01, y_offset=0.08,
label_location="inside");
render_venndir(vo2mb, main="Highlighted overlap");
# nudge a few labels using offset_list
vo2mc <- nudge_venndir_label(vo2m,
offset_list=list(`set_A&set_B`=c(-0.01, 0.08),
`set_A&set_C`=c(0, -0.03),
`set_B&set_C`=c(0.04, -0.03),
`set_A`=c(-0.02, 0),
`set_B`=c(0.02, 0)),
label_location="inside");
vo2mc <- nudge_venndir_label(vo2mc,
set=c("set_A", "set_B"), align_y="top")
render_venndir(vo2mc, main="Highlighted overlap,\nnudged labels");
# to control drawing order, place one polygon at the end of the line
vo2md <- vo2mc;
vo2md@jps <- vo2mc@jps[c(1:6, 8:10, 7),]
render_venndir(vo2md, main="Altered drawing order");
# modify multiple overlap_sets at once
vo2multi2 <- modify_venndir_overlap(vo2,
overlap_set=c("set_A", "set_B", "set_C"),
params=list(fill=c("gold", "gold", "gold"),
alpha=0.8,
innerborder="red",
innerborder.lwd=3,
fontsize=list(c(18, 13, 13, 13)),
label.border="black",
label.fill=jamba::alpha2col("palegoldenrod", alpha=0.8)
), reorder=TRUE);
render_venndir(vo2multi2, main="Multiple effects at once");
# modify multiple overlap_sets at once
vo2multi3 <- modify_venndir_overlap(vo2,
overlap_set=c("set_A&set_B", "set_B&set_C", "set_A&set_C",
"set_A&set_B&set_C"),
params=list(fill=c("gold"),
alpha=0.8,
border="red4",
innerborder="red",
innerborder.lwd=3,
label.border="black",
label.fill=jamba::alpha2col("palegoldenrod", alpha=0.8)
), reorder=TRUE);
render_venndir(vo2multi3, main="Multi-overlaps highlighed");
testlist4 <- make_venn_test(n_sets=4, do_signed=FALSE)
vo4 <- venndir(testlist4, main="Default test case")
# show all sections with set_B
vo4h <- highlight_venndir_overlap(vo4,
overlap_set=unique(grep("set_B", vo4@jps@polygons$venn_name, value=TRUE)))
render_venndir(vo4h, main="All overlaps with **set_B**")
# show set_C or set_D not set_B
vo4h2 <- highlight_venndir_overlap(vo4, outerborder.lwd=0,
overlap_set=unique(grep("set_B", value=TRUE, invert=TRUE,
grep("set_C|set_D", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h2, main="C or D, without B")
# show set_C not set_B or set_D
vo4h3 <- highlight_venndir_overlap(vo4,
overlap_set=unique(grep("set_B|set_D", value=TRUE, invert=TRUE,
grep("set_C", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h3, main="C without B or D")
# show set_A and set_C, not set_D
vo4h4 <- highlight_venndir_overlap(vo4,
overlap_set=unique(grep("set_D", value=TRUE, invert=TRUE,
grep("set_A.+set_C", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h4, main="A and C, without D")
# show set_A or set_B, each distinct
vo4h5 <- highlight_venndir_overlap(vo4,
outerborder.lwd=0,
overlap_set=unique(grep("&", value=TRUE, invert=TRUE,
grep("set_A|set_B", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h5, main="A or B alone")
vo4h5 <- highlight_venndir_overlap(vo4,
main="testing", bordercolor="blue", outerborder.lwd=0,
overlap_set=unique(grep("&", value=TRUE, invert=TRUE,
grep("set_C|set_D", vo4@jps@polygons$venn_name, value=TRUE)))
)
vo4h5 <- highlight_venndir_overlap(vo4h5,
main="testing", outerborder.lwd=0,
overlap_set=unique(grep("&", value=TRUE, invert=TRUE,
grep("set_A|set_B", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h5, main="A or B alone (red), or C or D alone (blue)")
# for complicated sections, use fill color as well
vo4h3way <- highlight_venndir_overlap(vo4,
main="testing",
params=list(innerborder="gold", innerborder.lwd=3,
fill="yellow",
outerborder.lwd=0),
overlap_set=unique(grep("&.+&.+&", value=TRUE, invert=TRUE,
grep("&.+&", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h3way, main="Three-way overlaps only")
# for complicated sections, use fill color as well
vo4h2way <- highlight_venndir_overlap(vo4,
main="testing",
params=list(innerborder="gold", innerborder.lwd=3,
fill="yellow",
outerborder.lwd=0),
overlap_set=unique(grep("&.+&", value=TRUE, invert=TRUE,
grep("&", vo4@jps@polygons$venn_name, value=TRUE)))
)
render_venndir(vo4h2way, main="Two-way overlaps only")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.