Closed dr-budd closed 10 months ago
please specify angle = 0
when layout
is circular geom is image
.
geom_tiplab(aes(image=uid, colour=body_mass), geom="phylopic", angle = 0 )
That works perfectly, thank you so much for your quick and helpful response!
pc2 <- ggtree(tree, layout="circular") %<+% d + geom_tiplab(aes(image=uid, colour=body_mass), geom="phylopic", angle=0, offset=2.5) + geom_tiplab(aes(label=label), offset = .2) + xlim(NA, 7) + scale_color_viridis_c()
pc2
Hi Dr. Yu,
Using your example from "Data Integration, Manipulation and Visualization of Phylogenetic Trees" Section "8.2 Annotating Tree with Phylopic" to illustrate my issue. When I plot the tree as it is in the example it looks great:
library(viridis)
library(ggtree)
library(ggimage)
newick <- "((Pongo_abelii,(Gorilla_gorilla_gorilla,(Pan_paniscus,Pan_troglodytes)Pan,Homo_sapiens)Homininae)Hominidae,Nomascus_leucogenys)Hominoidea;"
tree <- read.tree(text=newick)
d <- ggimage::phylopic_uid(tree$tip.label)
d$body_mass = c(52, 114, 47, 45, 58, 6)
p <- ggtree(tree) %<+% d + geom_tiplab(aes(image=uid, colour=body_mass), geom="phylopic", offset=2.5) + geom_tiplab(aes(label=label), offset = .2) + xlim(NA, 7) + scale_color_viridis_c()
p
However, when I attempt to use the circular layout, the image backgrounds become coloured:
pc <- ggtree(tree, layout="circular") %<+% d + geom_tiplab(aes(image=uid, colour=body_mass), geom="phylopic", offset=2.5) + geom_tiplab(aes(label=label), offset = .2) + xlim(NA, 7) + scale_color_viridis_c()
pc
I recently updated ggimage to 0.3.3 to fix the image distortion that previously occurred. This is an excellent fix for the distortion. However, I don't recall the background issue happening before the update. If I should post this in ggimage instead, my apologies and please let me know.
Thank you for making such excellent and useful packages!
Here's my session info:
Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] ggimage_0.3.3 ggplot2_3.4.3 ggtree_3.2.1 viridis_0.6.2 viridisLite_0.4.2
loaded via a namespace (and not attached): [1] Rcpp_1.0.9 pillar_1.9.0 compiler_4.1.3 yulab.utils_0.0.6 tools_4.1.3
[6] aplot_0.2.0 digest_0.6.31 tidytree_0.4.2 jsonlite_1.8.4 lifecycle_1.0.3
[11] tibble_3.2.1 gtable_0.3.4 nlme_3.1-161 lattice_0.20-45 pkgconfig_2.0.3
[16] rlang_1.1.1 DBI_1.1.3 cli_3.6.1 ggplotify_0.1.0 rstudioapi_0.14
[21] patchwork_1.1.3 magick_2.7.4 curl_5.0.2 parallel_4.1.3 treeio_1.23.0
[26] gridExtra_2.3 withr_2.5.0 dplyr_1.1.3 generics_0.1.3 vctrs_0.6.3
[31] gridGraphics_0.5-1 grid_4.1.3 tidyselect_1.2.0 glue_1.6.2 R6_2.5.1
[36] fansi_1.0.4 farver_2.1.1 purrr_1.0.2 tidyr_1.3.0 magrittr_2.0.3
[41] scales_1.2.1 colorspace_2.1-0 ape_5.7-1 rsvg_2.4.0 labeling_0.4.2
[46] utf8_1.2.3 lazyeval_0.2.2 munsell_0.5.0 ggfun_0.1.2