Skip to content

Commit

Permalink
Update ggplot2.R
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbates committed Sep 17, 2024
1 parent 5a8ebe2 commit 13b2d8c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/ggplot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,10 @@ geom_neuron.splitneuron <- function(x = NULL,
error = function(e) NULL)

# Stitch subtree
dendrites <- nat::stitch_neurons_mst(dendrites)
axon <- nat::stitch_neurons_mst(axon)
p.d <- nat::stitch_neurons_mst(p.d)
p.n <- nat::stitch_neurons_mst(p.n)
dendrites <- tryCatch(nat::stitch_neurons_mst(dendrites), error = function(e) NULL)
axon <- tryCatch(nat::stitch_neurons_mst(axon), error = function(e) NULL)
p.d <- tryCatch(nat::stitch_neurons_mst(p.d), error = function(e) NULL)
p.n <- tryCatch(nat::stitch_neurons_mst(p.n), error = function(e) NULL)

# Make into a multi-segmen neuroblist
nulls <- nat::nlapply(1:length(nulls$SubTrees), function(subt) tryCatch(nat::prune_vertices(nulls,
Expand All @@ -699,6 +699,9 @@ geom_neuron.splitneuron <- function(x = NULL,
error = function(e) NULL),
.progress = FALSE)
nulls <- nulls[unlist(lapply(nulls, length))>0]
if(!length(nulls)){
nulls <- NULL
}

# Make ggplot2 objects
g.dendrites <- ggplot2_neuron_path(dendrites, rotation_matrix = rotation_matrix)
Expand Down

0 comments on commit 13b2d8c

Please sign in to comment.