Plotting trait data"

knitr::opts_chunk$set(collapse = TRUE, fig.width = 7, fig.height = 5, fig.align = "center")
Many packages exist to visualize trait data for biological species. __deeptime__ similarly has a few novel ways to help you plot your data in useful ways. We'll first load some packages and example data so we can demonstrate some of this functionality. wzxhzdk:1 ## Plot disparity through time A common way to visualize trait data, especially for fossil species, is to show the two-dimensional trait distribution for several time intervals. This allows the viewer to easily compare the trait distribution through time. However, producing such a plot has historically been very time intensive, often involving the use of custom code and image editing software (e.g., [Inkscape](https://inkscape.org/)). While a single function to accomplish such a visualization still does not exist for `{ggplot2}` (yet...), the `coord_trans_xy()` function can be used to generate a similar plot with sheared trait space across several time intervals. wzxhzdk:2 ### Disparity in base R The `disparity_through_time()` function accomplishes nearly all of the work for you if you are comfortable plotting within the `{lattice}` framework (base R). Note that it may take some tweaking (especially the `aspect` argument) to get the results to look the way you want. wzxhzdk:3 ## Phylomorphospaces Often, trait data will be accompanied with a phylogeny. You may want to visualize both your phylogeny, the traits of your species, and the evolution of the trait along your phylogeny. To accomplish this, you can create a two-dimensional phylomorphospace. The `{phytools}` package has the `phytools::phylomorphospace()` function for accomplishing this in base R. The `geom_phylomorpho()` function in __deeptime__ will help you accomplish this with `ggplot()`. Note that labels can be added using `geom_label()` or `ggrepel::geom_label_repel()`, but they are not demonstrated here because they would obscure the phylogenetic relationships. wzxhzdk:4


Try the deeptime package in your browser

Any scripts or data that you put into this service are public.

deeptime documentation built on Feb. 16, 2023, 10:59 p.m.