ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

geom_hilight rectangle unreasonably long

Open ETaSky opened this issue 1 year ago • 0 comments
trafficstars

Prerequisites

Ask in right place

  • [ x] for bugs or feature requests, post here (github issue)

Problem description

First of all, thanks for the excellent package. I am reporting a tiny issue that may be quite easy to be fixed. As shown in the following graph using geom_hilight (since it is obvious, I did not attach the tree). p + theme_tree2() + geom_hilight(p$data %>% filter(isTip), to.bottom = T , aes(node = node), type = "rect") example

the length of the hilight bar on x-axis is too long for some occasions (as highlighted by the red lines), both extend and extendto are not able to gracefully handle this situation because it is due to the branch length is too long and the xmax of that tip seems directly related to the branch length according to line 444-455 #https://github.com/YuLab-SMU/ggtree/blob/38016ab1e3fde1ff88ec131e2e6e89aa4a234d9d/R/geom_hilight.R#L444

I think it would be nicer that remove the branch length depended behaviour, and control the length just use extend (with a default value) and extendto. I don't know how to make modifications to the functions so it would be great if you can help with the issue.

Thanks!

ETaSky avatar Feb 26 '24 02:02 ETaSky