Added new `edge_alpha` argument and flipped default colour scheme from black to white.
This commit is contained in:
Martin Chan 2021-05-18 14:59:57 +01:00
Родитель 74f8d9de87
Коммит 7fefc70d7b
4 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -48,7 +48,9 @@
#' @param palette Function for generating a colour palette with a single #' @param palette Function for generating a colour palette with a single
#' argument `n`. Uses "rainbow" by default. #' argument `n`. Uses "rainbow" by default.
#' @param node_alpha A numeric value between 0 and 1 to specify the transparency #' @param node_alpha A numeric value between 0 and 1 to specify the transparency
#' of the nodes. #' of the nodes. Defaults to 0.7.
#' @param edge_alpha A numeric value between 0 and 1 to specify the transparency
#' of the edges (only for 'ggraph' mode). Defaults to 1.
#' @param res Resolution parameter to be passed to `leiden::leiden()`. Defaults #' @param res Resolution parameter to be passed to `leiden::leiden()`. Defaults
#' to 0.5. #' to 0.5.
#' @param seed Seed for the random number generator passed to `leiden::leiden()` #' @param seed Seed for the random number generator passed to `leiden::leiden()`
@ -144,11 +146,12 @@ network_p2p <- function(data,
return = "plot", return = "plot",
path = paste0("network_p2p_", display), path = paste0("network_p2p_", display),
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"), desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
bg_fill = "#000000", bg_fill = "#FFFFFF",
font_col = "#FFFFFF", font_col = "grey20",
legend_pos = "bottom", legend_pos = "bottom",
palette = "rainbow", palette = "rainbow",
node_alpha = 0.7, node_alpha = 0.7,
edge_alpha = 1,
res = 0.5, res = 0.5,
seed = 1, seed = 1,
algorithm = "mds", algorithm = "mds",
@ -337,7 +340,7 @@ network_p2p <- function(data,
plot_output <- plot_output <-
g_layout + g_layout +
ggraph::geom_edge_link(colour = "lightgrey", edge_width = 0.05, alpha = 0.15) + ggraph::geom_edge_link(colour = "lightgrey", edge_width = 0.05, alpha = edge_alpha) +
ggraph::geom_node_point(aes(colour = !!sym(v_attr)), ggraph::geom_node_point(aes(colour = !!sym(v_attr)),
alpha = node_alpha, alpha = node_alpha,
pch = 16) + pch = 16) +

Просмотреть файл

@ -39,7 +39,7 @@ list of options.}
path based on current parameters.} path based on current parameters.}
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency \item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
of the nodes.} of the nodes. Defaults to 0.7.}
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults \item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults
to 0.5.} to 0.5.}

Просмотреть файл

@ -28,7 +28,7 @@ network_louvain(
\item{font_col}{String to specify font and link colour.} \item{font_col}{String to specify font and link colour.}
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency \item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
of the nodes.} of the nodes. Defaults to 0.7.}
\item{algorithm}{String to specify the node placement algorithm to be used. \item{algorithm}{String to specify the node placement algorithm to be used.
Defaults to \code{"mds"} for the deterministic multi-dimensional scaling of Defaults to \code{"mds"} for the deterministic multi-dimensional scaling of

Просмотреть файл

@ -11,11 +11,12 @@ network_p2p(
return = "plot", return = "plot",
path = paste0("network_p2p_", display), path = paste0("network_p2p_", display),
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"), desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
bg_fill = "#000000", bg_fill = "#FFFFFF",
font_col = "#FFFFFF", font_col = "grey20",
legend_pos = "bottom", legend_pos = "bottom",
palette = "rainbow", palette = "rainbow",
node_alpha = 0.7, node_alpha = 0.7,
edge_alpha = 1,
res = 0.5, res = 0.5,
seed = 1, seed = 1,
algorithm = "mds", algorithm = "mds",
@ -70,7 +71,10 @@ the 'ggraph' plotting method is being used.}
argument \code{n}. Uses "rainbow" by default.} argument \code{n}. Uses "rainbow" by default.}
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency \item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
of the nodes.} of the nodes. Defaults to 0.7.}
\item{edge_alpha}{A numeric value between 0 and 1 to specify the transparency
of the edges (only for 'ggraph' mode). Defaults to 1.}
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults \item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults
to 0.5.} to 0.5.}