layout="circular" and layout="slanted" at the same time?

134 views
Skip to first unread message

Rie Sadohara

unread,
Feb 24, 2022, 8:14:34 PM2/24/22
to ggtree
Hello, is it possible to have a circular tree plot with slanted branches?  I know non-circular trees can have slanted branches, but with circular trees, I do not know how to do it.  

library(ggtree)
set.seed(123)
tree <- rtree(30)
ggtree(tree, layout = 'circular', layout='slanted') 
# This gives an error saying there must be only one layout argument.  

Thanks,

Rie

Yu, Guangchuang

unread,
Feb 26, 2022, 10:31:52 AM2/26/22
to Rie Sadohara, ggtree
pls try layout = 'radial'

--
1. Data Integration, Manipulation and Visualization of Phylogenetic Trees (1st ed.). Chapman and Hall/CRC. 2022. ISBN: 9781032233574
2. ggtreeExtra: Compact visualization of richly annotated phylogenetic data. Molecular Biology and Evolution. 2021, 38(9):4039-4042. doi: 10.1093/molbev/msab166
3. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics. 2020, 69:e96. doi: 10.1002/cpbi.96
4. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution. 2020, 37(2):599-603. doi: 10.1093/molbev/msz240
5. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 2018, 35(2):3041-3043. doi: 10.1093/molbev/msy194
6. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in Ecology and Evolution. 2017, 8(1):28-36. doi: 10.1111/2041-210X.12628
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/a6222b20-39a1-44ac-824e-6efd72bc9845n%40googlegroups.com.


--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Professor, Director
Department of Bioinformatics
School of Basic Medical Sciences
Southern Medical University
Guangzhou, China
-~----------~----~----~----~------~----~------~--~---

Rie Sadohara

unread,
Feb 26, 2022, 10:03:29 PM2/26/22
to ggtree
It does what I wanted to do! Thank you so much!

Rie

Rie Sadohara

unread,
May 3, 2023, 1:52:52 AM5/3/23
to ggtree
Hello again,

Recently I found that "radial" option throws an error. Here is an example using the script from the Reproducible example

  library(TDbook)
  library(tibble)
  library(tidyr)
  library(Biostrings)
  library(treeio)
  library(ggplot2)
  library(ggtree)
 
  # loaded from TDbook package
  tree <- tree_HPV58
  ggtree(tree, layout = "radial")  

This returns an error: 
Error in `stat_tree()`:
! Problem while converting geom to grob.
i Error occurred in the 1st layer.
Caused by error in `check.length()`:
! 'gpar' element 'lwd' must not be length 0


But ggtree(tree, layout = "circular")  works fine.  How come...?  Is there a way to get around it?  I would like to use the slanted layout. Thanks,
Rie 
Reply all
Reply to author
Forward
0 new messages