summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorChris Sobczak <chris@sobczak.family>2026-06-15 21:18:11 -0700
committerChris Sobczak <chris@sobczak.family>2026-06-15 21:18:11 -0700
commit25fb074f4820024b59d3a7990de2499a238d816a (patch)
tree5a738e5dc35444e8b5c17d0dc8b557b85f1dd131 /R
parent25cb322d244542d76613bb5918d06cc86b24bf20 (diff)
Improve nodes
Diffstat (limited to 'R')
-rw-r--r--R/networkplot.R22
1 files changed, 15 insertions, 7 deletions
diff --git a/R/networkplot.R b/R/networkplot.R
index b95d979..98ee35c 100644
--- a/R/networkplot.R
+++ b/R/networkplot.R
@@ -162,10 +162,12 @@ networkplot <- function(R, groups = NULL, group_label = NULL, title = NULL){
ggplot2::aes(
filter = .data$leaf,
colour = .data$group,
- size = .data$importance,
- x = .data$x * 1.05,
- y = .data$y * 1.05
- )
+ fill = .data$group,
+ size = log(.data$importance)
+ ),
+ shape = 21,
+ stroke = 0.4,
+ alpha = 0.6
) +
ggplot2::scale_size_continuous(
range = c(1, 6), # tweak this
@@ -176,8 +178,8 @@ networkplot <- function(R, groups = NULL, group_label = NULL, title = NULL){
ggplot2::aes(
filter = .data$leaf,
label = .data$name,
- x = .data$x * 1.1,
- y = .data$y * 1.1,
+ x = .data$x * 1.05,
+ y = .data$y * 1.05,
angle = atan2(.data$y, .data$x) * 180 / pi,
),
hjust = 0,
@@ -201,7 +203,13 @@ networkplot <- function(R, groups = NULL, group_label = NULL, title = NULL){
if(!is.null(groups)){
p <- p +
- ggplot2::scale_colour_discrete(name = group_label)
+ ggplot2::scale_colour_discrete(name = group_label) +
+ ggplot2::scale_fill_discrete(name = group_label)
+ }else{
+ p <- p + ggplot2::guides(
+ colour = 'none',
+ fill = 'none'
+ )
}
return(p)