2016-10-15 2 views
0

나는 계통 발생 트리를 그린다. 그리고 나는 멸종 된 종의 끝 부분에 'dead symbol̈̈'(예 : 두개골)과 같은 것을 추가하고 싶다.계통 발생 트리에 심볼과 정보 추가하기

도트로 표시된 분기 시간 (예 : $ \ Delta t_i $ 또는 숫자)에 라텍스 기호가있는 x 축 막대를 추가하고 싶습니다.

나는 지금까지이 나무를 가지고 있습니다. 이 경우 녹색 점선 바로 뒤에있는 데드 심볼을 추가하고 싶습니다.

library(ape) 
rec1 = '((B:1,A:1):1,(F:1,C:1.5):0.5);' 
rec1 = read.tree(text = rec1) 
plot(rec1,show.tip.label = F,edge.color = c("black","black","black","black","darkgreen","black"),edge.width = 2,edge.lty = c(rep(1,4),4,1)) 
+0

로는 아무도이 게시물을 볼 것 같다. 어떻게 보이게 할 수 있을까요? – Francisco

답변

0

트리 끝에 "멸종 된"기호를 표시하는 방법에는 두 가지 옵션이 있습니다.

  1. this blog으로 표시 할 수있는 적절한 글꼴로 유니 코드 기호를 사용하십시오.
  2. 래스터 이미지를 트리 플롯에 추가하십시오.

다음 코드는 트리의 녹색 가장자리 옆에 extinction symbol으로 표시됩니다. 발견 된 정보는 here입니다.

library(jpeg) 
logo <- readJPEG("Downloads/Symbol1.jpg") 
logo2 <- as.raster(logo) 
r <- nrow(logo2)/ncol(logo2) # aspect ratio 
s <- 0.4 # symbol size 

# display plot to obtain its size 
plot(rec1, edge.color = c("black","black","black","black","darkgreen","black"), 
    edge.width = 2, edge.lty = c(rep(1,4),4,1)) 
lims <- par("usr") # plot area size 
file_r <- (lims[2]-lims[1])/(lims[4]-lims[3]) # aspect ratio for the file 
file_s <- 480 # file size 

# save tree with added symbol 
png("tree_logo.png", height=file_s, width=file_s*file_r) 
plot(rec1, show.tip.label = F, 
    edge.color = c("black","black","black","black","darkgreen","black"), 
    edge.width = 2, edge.lty = c(rep(1,4),4,1)) 
rasterImage(logo2, 1.6, 2.8, 1.6+s/r, 2.8+s) 

# add axis 
axisPhylo() 
mtext(expression(Delta*italic("t")["i"]), side = 1, line = 3) 
dev.off() 

enter image description here

+0

고맙습니다. 이것은 부분적으로 내 문제를 해결합니다. – Francisco

+0

@Francisco 어때 어때? 내가 요청한 축을 추가했습니다. – nya

+1

감사합니다. 나는 이것이 내 문제에 대한 해결책이라고 생각한다. – Francisco

1

하나의 가능성은 ggtree을 사용하고 있습니다. 마찬가지로 : https://www.bioconductor.org/packages/devel/bioc/vignettes/ggtree/inst/doc/advanceTreeAnnotation.html

#source("https://bioconductor.org/biocLite.R") 
#biocLite("BiocUpgrade") # you may need this 
#biocLite("ggtree") 
library(ggtree) 
imgfile <- tempfile(, fileext=".png") 
download.file("https://avatars1.githubusercontent.com/u/626539?v=3&u=e731426406dd3f45a73d96dd604bc45ae2e7c36f&s=140", destfile=imgfile, mode='wb') 
img <- list(imgfile, imgfile) 
names(img) <- c("1", "2") 
p<-ggtree(rtree(20)) 
inset(p, img) 

phylopic

#https://github.com/sckott/rphylopic 
# devtools::install_github("sckott/rphylopic") 
library('rphylopic') 
string<-name_search(text = "Homo sapiens") 
selectstr<-string[2,] 
string2<-name_images(uuid = selectstr)$same[[1]]$uid 
tree<-rtree(10) 
ggtree(tree) %>% phylopic(string2, color="steelblue", alpha = .8, node=10, width=0.5) 

enter image description here

관련 문제