liamrevell / phytools

GNU General Public License v3.0
198 stars 56 forks source link

dotTree with missing data #117

Open HedvigS opened 1 year ago

HedvigS commented 1 year ago

dear Dr @liamrevell

I like phytools::dotTree(), it's simple and handy!

I have a case where I'm plotting discrete values and there are some missing values. I'd like these to be handled differently, but now they're filled in with white which looks like it's part of the scale.

Here's an example:

poly_tree_example

What I've done here after pruning the tree (poly_tree) and data frame (poly_tree_tip_value_df) with data is this:


colours <- c("#ffffbf","#8856a7")
feature_vec <- poly_tree_tip_value_df$GB409 %>% as.character()

fmode<-as.factor(setNames(poly_tree_tip_value_df$GB409,poly_tree_tip_value_df$Name))

dotTree(ladderize(poly_tree,right = F),x = fmode,colors=setNames(colours,
                                       c("0","1")),fsize=1, legend = F)

I saw your blog post about setting pts to F, but this made no difference I'm afraid.

I see these solutions:

What do you think?

Happy for any advice :)

HedvigS commented 2 months ago

I ended up solving this by setting border to "transparent" and those values to white

Not sure if I should leave this issue up in case it ends up going in some documentation somewhere that this is one solution.

Screenshot 2024-04-22 at 22 45 51