liamrevell / phytools

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

outline color argument to dotTree #136

Closed HedvigS closed 1 year ago

HedvigS commented 1 year ago

I'd like to have an argument to dotTree that governs the outline of the dots. It defaults to black, but I'd like to set it to transparent/white. I want to do this because I want missing data to have white dots with white outline (i.e. be "invisible"). Given ggplot terminology, this would be called "color" (as opposed to "fill"), but that might get confusing so probably another term is needed.

In the example below, I'd like the dot for Rapanui to be white in the interior and in the outline. If there is a deep argument to phylo.heatmap or plotTree that refers to this I'd love to know, and I'll use that.

poly_tree_example

HedvigS commented 1 year ago

Code for example below is here: https://github.com/HedvigS/Oceanic_computational_ASR/blob/8c0b225d6153f4f999cebf466c42413f88807938/code/03_polynesian_viz.R#L46

liamrevell commented 1 year ago

Now in phytools. (See post here: http://blog.phytools.org/2023/06/control-dot-border-colors-in-phytools.html.)

HedvigS commented 1 year ago

I LOVE IT! ⭐⭐⭐⭐⭐

HedvigS commented 1 year ago

One small problem, I've installed phytools from github (remotes::install_github("liamrevell/phytools")) but I'm not getting the border argument for dotTree. What could be happening? I've explicitly removed any other installation with remove.packages and I have loaded the package with library.

HedvigS commented 1 year ago

I've tried specifying the branch and commit, but I still don't get any effect by using the argument border with phytools::dotTree()

colours <- c("#ffffbf","#8856a7")

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

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

poly_tree_example

liamrevell commented 1 year ago

I cannot explain it. Try shutting down all open R sessions, restarting R, and reinstalling phytools from GitHub.

HedvigS commented 1 year ago

Got it, will do :)!

HedvigS commented 1 year ago

Restarting R worked we have success!

I'm sorry I didn't think of that, I just got partially mentally blind some how. Thank you for your patience @liamrevell !

posc test