-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_ChromEvol_simple.R
40 lines (29 loc) · 1.21 KB
/
plot_ChromEvol_simple.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# This R script plots the ancestral chromosome numbers estimated
# by a ChromoSSE RevBayes analysis.
#
library(ggplot2)
library(RevGadgets)
library(ggtree)
# plot the ancestral states tree generated by RevBayes
p = plot_ancestral_states(tree_file="output/Consenso.tree",
summary_statistic="MAPChromosome",
include_start_states=FALSE,
tip_label_size=3.5,
tip_label_offset=0.002,
tip_label_italics=TRUE,
node_label_size=3.2,
node_label_nudge_x=0.0005,
xlim_visible=c(0, 0.05),
shoulder_label_size=2,
alpha=.3,
show_posterior_legend=TRUE,
title="Diploid number")
#using ggtree and ggplot2 functions we can now add all sorts of details
# to our figure:
# annotate some of the clades
p = p + geom_cladelabel(node=2, label="Clade A", align=TRUE, offset=0.02, size=2, extend=5)
p = p + geom_cladelabel(node=36, label="Clade B", align=TRUE, offset=0.02, size=2)
# write pdf
print(p)
ggsave("output/Diploid_tucos.pdf")