summaryrefslogtreecommitdiff
path: root/R/networkplot.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/networkplot.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)