YuLab-SMU / ggtree

:christmas_tree:Visualization and annotation of phylogenetic trees
https://yulab-smu.top/treedata-book/
821 stars 172 forks source link

theme_tree2 scale bar width #613

Open cabraham03 opened 3 months ago

cabraham03 commented 3 months ago

Hi, I just want to know how to increase the width in the scale bar using theme_tree2, I'm using the default parameters for theme_tree2. to generate the tree I use the size of 1 [Ptree <-ggtree(treeUPGMA, size=1)], so I just want that the width in the scale bar to be close to the size in the line of the tree, maybe ~0.8. Any suggestion ?

Ptree + 
    geom_text(aes(label=bootstrap, hjust=hj, vjust=vj), size=3.7) + theme_tree2() + 
    geom_nodelab(aes(subset = (node == 23), label = "A-genotype"), color = "black", nudge_x = -0.0006, nudge_y = 0.6, hjust = 1, size=5.5) + 
    geom_nodelab(aes(subset = (node == 24), label = "B-genotype"), color = "black", nudge_x = -0.0006, nudge_y = 0.6, hjust = 1, size=5.5) + 
    geom_tippoint(aes(shape=vcg), size=3.5, alpha=0.7, x=0.02025) + 
    scale_shape_manual(values = c(15,19), labels=lbs) +  
    theme(legend.position=c(0.12, 0.75),                        
          legend.title=element_blank(),                         
          legend.text=element_text(size=17, family="Times New Roman", face = "italic"),  
          # Scale font size
          axis.text.x=element_text(size=10, family="Times New Roman", face = "bold"), 
          plot.margin = unit(c(t=0.3, r=0.055, b=0.3, l=0.01), "cm")  
    )