This function is used to create a dot and whisker plot of model estimates. requires package 'ggplot2'

plot_est(
  data,
  aes_plot,
  aes_err,
  Title = NULL,
  r_squared = NULL,
  xlabs = NULL,
  palette = NULL,
  shapes = NULL,
  fill = NULL,
  plot_theme = NULL
)

Arguments

data

A data frame holding the beta estimate and their confidence intervals

aes_plot

An aesthetic mapping object returned by the aes() function and passed on to ggplot().

aes_err

An aesthetic mapping object returned by the aes() function and passed on to geom_errorbar().

Title

Optional. A character to be displayed as the plot's title

r_squared

Optional. A number equal to the R squared for the model to be displayed as the plot's subtitle

xlabs

Optional. A vector of labels for each value along the x axis

palette

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

shapes

Optional. A list of length 2 with the first element holding aes(shapes = group) to be passed on to geom_points where 'group' is the same as in aes_plot. 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

fill

Optional. A vector that holds the color(s) to fill the point shapes with

plot_theme

Optional. An object returned by the theme() function. See help(theme) for more details

Value

A dot and whisker plot in the form of a ggplot object

Examples

if (FALSE) {

library(here)
library(ggplot2)

ests <- read.csv(file.path(here(), 'data_out', 'Avg_Est_SR.csv'), header = TRUE)
tmp <- droplevels(ests[which(ests$Taxon == 'Anolis' & ests$Variable != '(Intercept)'), ])

plot_est(data = tmp,
         aes_plot = aes(x = Variable, y = Estimate, colour = Group),
         aes_err = aes(ymin = LCL, ymax = UCL, col = Group),
         Title = "Anolis Lizards",
         r_squared = data.frame(V1 = c('Exotic', 'Native', 'Total'),
                                R2 = c(0.23, 0.1, 0.123456)),
         palette = c("red3", "blue3", "chocolate3"),
         shapes = list(aes(shape = Group), c(16, 23, 15)),
         fill = 'white')

}