## Specifying a trait process
my_trait <- make.traits()
## Plotting a trait process
plot(my_trait, main = "A Brownian Motion")
## Simulating a tree with ten taxa
my_tree <- treats(stop.rule = list(max.taxa = 10))
## Plotting a simple birth death tree (using ape::plot.phylo)
plot(my_tree, main = "A pure birth tree")
## Simulating a tree with traits
my_data <- treats(stop.rule = list(max.taxa = 10),
traits = my_trait)
## Plotting the tree and traits
plot(my_data)
## Specifying a 3D trait process
my_3D_trait <- make.traits(n = 3)
## Simulating a birth death tree with that trait
my_data <- treats(bd.params = list(extinction = 0.2),
stop.rule = list(max.living = 50),
traits = my_3D_trait)
## Plotting the second trait and the tree (default)
## The colours are purple for nodes and blue for tips
## with a black circle for highlighting the tips
plot(my_data, trait = 2, col = c("purple", "blue"),
edges = "pink", tips.nodes = "black")
## Plotting the first and third trait correlation
## The colours are a heat map based on the elements age
plot(my_data, trait = c(1,3), col = terrain.colors,
edges = "grey", tips.nodes = "black")
## Plotting the first and third trait correlation in 3D
plot(my_data, trait = c(1,3), col = rainbow,
edges = "grey", tips.nodes = "black", use.3D = TRUE)
#rglwidget() # to display the plot with non-default OpenRGL
## Plotting all traits in 3D (without branch lengths)
plot(my_data, trait = c(1:3), col = heat.colors,
edges = NULL, tips.nodes = "black", use.3D = TRUE)
#rglwidget() # to display the plot with non-default OpenRGL
Run the code above in your browser using DataLab