'How to shorten/truncate a branch in ggtree

With a phylo tree generated with the R packages APE and plotting with ggtree - is anyone aware of a method to make branches shorter?

My angle is that I'm comparing mostly intra-species, but added the two most closely related species, partly to root the tree. However, the evolutionary distance from the closely related species is much higher than intra-species, of course, and this means that I have a super long branch that takes up too much space + it's harder to make out the details of the intra-species differences because the image gets zoomed out to show the other species.

The obvious manual solution is to alter the image outside of R, but I'd prefer a programming solution.

As far as I can see, ggtree has a 'zoom' function, but this is only concerned with width of a clade, not the depth. I have seen plots from ggtree with the sort of truncation that I've mentioned (showing the truncated region with a dotted line), but I'm unaware if these details were edited after finishing the plot.

Here's the tree I'm working with

Here's code to produce a tree with data from ape. The problem of truncation could be applied to most branches here, too.

library(ape)
library(ggtree)
data("woodmouse")
woodmouse %>% 
  dist.dna() %>% 
  nj() %>% 
  ggtree() + 
  ggtitle("Example") + 
  geom_treescale()

Example



Solution 1:[1]

Have you tried

ggtree()
  xlim(-18, +25) + 
  ggtitle("Example") + 
  geom_treescale()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1