extract label_repel layer from netify plot components
Source:R/plot_helpers.R
netify_label_repel.Rdextracts the label_repel layer from a netify plot components object. label repel annotations display actor names with background boxes and automatic repositioning to avoid overlaps, providing optimal readability in dense networks.
Value
a custom object of class "netify_label_repel" that can be added to a ggplot object using the + operator. the object contains the label_repel layer with all its aesthetic mappings and data.
Examples
# \donttest{
# create a netify object
mat <- matrix(c(NA, 1, 0, 0, NA, 1, 1, 0, NA), 3, 3,
dimnames = list(c("alice", "bob", "carol"),
c("alice", "bob", "carol")))
net <- new_netify(mat, symmetric = FALSE)
# get plot components with label_repel
comp <- plot(net, add_label_repel = TRUE, return_components = TRUE)
# build custom plot with repelled labels
library(ggplot2)
ggplot() +
netify_label_repel(comp)
# }