YuLab-SMU / ggtree

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

Request to add roundrect.r option to layout.params #596

Open n8layman opened 7 months ago

n8layman commented 7 months ago

Prerequisites

Describe you issue

Ask in right place

It would be very useful to be able to modify the curvature of the tree when using the roundrect layout. For example to add just a little bit of curvature but not as much as is the default. Perhaps by modifying a roundrect.r layout parameter similar to what is available in geom_hilight. Please forgive me if this is already possible, I was unable to find any method after looking through the issues, discussion, google group, or code.

xiangpin commented 5 months ago

you can use shape argument (default is 0.5, should be a numeric vector of values between -1 and 1) to control the radius of the rounded corners when layout='roundrect'.

for example

library(ggtree)
set.seet(123)
tree <- rtree(10)
p1 <- tree |> ggtree(layout='roundrect')
p2 <- tree |> ggtree(layout='roundrect', shape=.25)

image