ggtree
ggtree copied to clipboard
geom_tiplab angle off when collapsing clades in circular layout
trafficstars
Hello,
I am running into an issue where, when geom_tiplab is used in conjunction with scaleClade, the tip labels are rendering at the angle they would be if they were in their original positions. This causes them to progressively get further away from the desired angle. Further, the geom_point2 disappears after scaling. See p (before scaling) and p2 (after scaling) below.
My code
p <- ggtree(speciestree, layout='circular') %<+% tipdatasimple + xlim_tree(-1) +
geom_tiplab(aes(label=species, color=kingdom), angle="auto", size=2, align=TRUE, linesize=0.1) +
geom_tree(aes(color=kingdom)) +
scale_color_manual(values = subgroup_colors) +
ggnewscale::new_scale_fill() +
scale_fill_carto_c(name = "Orthologue count", palette = "DarkMint", limits=c(0,10), breaks=c(0,2,4,6,8,10)) +
geom_point2(aes(subset = in_orthocounts, x = max(x) -0.05, fill=count), shape=21, size=2, stroke=NA) +
geom_text2(aes(subset = in_orthocounts, x = max(x) -0.05, label = count), size = 1.2, color = "grey20")
p2 <- scaleClade(p, 421, 0.1) %>%
scaleClade(574, 0.1) %>%
scaleClade(485, 0.1) %>%
collapse(421, 'max', fill="tan") %>%
collapse(574, 'max', fill="grey") %>%
collapse(485, 'max', fill="#108454")
p
p2
Scaling before adding labels and data does not change this outcome. Any help on this much appreciated.