From 25fb074f4820024b59d3a7990de2499a238d816a Mon Sep 17 00:00:00 2001 From: Chris Sobczak Date: Mon, 15 Jun 2026 21:18:11 -0700 Subject: Improve nodes --- R/networkplot.R | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'R/networkplot.R') 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) -- cgit v1.2.3