plot_est_age.Rd
This function is used to create a scatter plot of model estimates against clade age. Requires package 'ggplot2'
plot_est_age(
data,
X,
Y,
Group = NULL,
abs.value = FALSE,
var = NULL,
Title = NULL,
palette = NULL,
shapes = NULL,
fill = NULL,
plot_theme = NULL
)
A data frame holding at least the beta estimates and age for each clade.
A character equal to the name of the column in data
that holds the clade ages
A character equal to the name of the column in data
that holds the estimates
Optional. A character equal to the name of the column in data
that
holds the groups.
Logical. If TRUE
, then the absolute value of the estimates is plotted.
Optional. A character equal to the name of the variable the beta estimates are for
Optional. A character to be displayed as the plot's title
Optional. A vector with length equal to the number of groups to be displayed.
This vector is passed on to scale_color_manual()
to dictate the color representation
of each group
Optional. A list of length 2 with the first element holding a character equal to
the name of the column in data
that holds the groups. The second element should be a
vector with length equal to the number of groups to be displayed. This vector is passed on to
scale_shape_manual()
to dictate the shape representation of each group
Optional. A vector that holds the color(s) to fill the point shapes with
Optional. An object returned by the theme()
function.
See help(theme)
for more details
A scatter plot of estimates against clade ages in the form of a ggplot object
if (FALSE) {
library(here)
library(ggplot2)
ests <- read.csv(file.path(here(), 'data_out', 'Avg_Est_SR.csv'), header = TRUE)
ages <- read.csv(file.path(here(), 'data_out', 'Herp_Taxon_Ages.csv'), header = TRUE)
names(ages)[1] <- 'Taxon'
dat <- merge(ests, ages, by = 'Taxon', all.x = TRUE)
dat <- droplevels(dat[which(dat$Group == 'Total' | dat$Group == 'Native'), ])
tmp <- droplevels(dat[which(dat$Variable == 'Area'), ])
(plot_est_age(data = tmp,
X = "Age",
Y = "Estimate",
Group = "Group",
var = "Area",
Title = "Effect of Area by Clade Age",
palette = c("red3", "blue3"),
shapes = list("Group", c(16, 23)),
fill = 'white'))
}