Skip to content

Commit

Permalink
Fix errors when all bootstrap values are filtered out
Browse files Browse the repository at this point in the history
  • Loading branch information
arcresu committed May 22, 2024
1 parent 49aa921 commit fa8fd3b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions R/plot_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ plot_tree <- function(phylepic, label = .data$name, bootstrap = TRUE) {

if (bootstrap && (".phylepic.bootstrap_numeric" %in% colnames(tr_layout))) {
p <- p + ggraph::geom_edge_elbow(
aes(
filter = (
(!.data$node2.leaf) &
(length >= 0.05 * max(length)) &
aes(label = round(.data$node2..phylepic.bootstrap_numeric, digits = 0)),
data = function(layout) {
ggraph::get_edges()(layout) |>
dplyr::filter(
(!.data$node2.leaf),
(length >= 0.05 * max(length)),
round(.data$node2..phylepic.bootstrap_numeric, digits = 0) > 0
),
label = round(.data$node2..phylepic.bootstrap_numeric, digits = 0)
),
)
},
flipped = TRUE,
label_pos = 0.75,
label_size = 3,
Expand Down

0 comments on commit fa8fd3b

Please sign in to comment.