diff options
Diffstat (limited to 'R/networkplot.R')
| -rw-r--r-- | R/networkplot.R | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/R/networkplot.R b/R/networkplot.R index cbea488..cfc2b13 100644 --- a/R/networkplot.R +++ b/R/networkplot.R @@ -159,7 +159,9 @@ networkplot <- function(R, groups = NULL, group_label = NULL, title = NULL, r_la ggraph::geom_node_point( ggplot2::aes( filter = .data$leaf, - colour = .data$group + colour = .data$group, + x = .data$x * 1.05, + y = .data$y * 1.05 ), size = 2 ) + @@ -167,12 +169,21 @@ networkplot <- function(R, groups = NULL, group_label = NULL, title = NULL, r_la ggraph::geom_node_text( ggplot2::aes( filter = .data$leaf, - label = .data$name + label = .data$name, + x = .data$x * 1.1, + y = .data$y * 1.1, + angle = atan2(.data$y, .data$x) * 180 / pi, + hjust = ifelse( + atan2(.data$y, .data$x) > pi / 2 | atan2(.data$y, .data$x) < -pi / 2, + 1, 0 + ) ), - # prevents text labels from overlapping - hjust = 'outward', size = 2 ) + + ggplot2::expand_limits( + x = c(-1.2, 1.2), + y = c(-1.2, 1.2) + ) + ggplot2::theme_void() if(!is.null(title)){ |
