Packages and Data

setwd("~/Graph Class")
library(tidyverse)
ps <- read.csv("hutler_pika_stress.csv")
str(ps)
head(ps)
hf <- read.csv("Pika_hab_summary.csv") 
str(hf)
head(hf)
site_labs <- c("Cable Gate", "Long Lake", "West Knoll")
names(site_labs) <- c("CG", "LL", "WK")

Pika stress levels per site

This graph comes from data from a paper by Whipple and Ray, titled “Physiological stress of American pika (Ochotona princeps) and associated habitat characteristics for Niwot Ridge, 2018 - 2019”. The data in this paper is exploring how habitat differences play a role in stress in pikas, particularly changes in the concentration of GCM (glucocorticoid metabolite) levels in their feces, with this particular graph exploring average fecal GCM concentrations within the three different sites that were sampled. From the graph, the differences between the sites don’t seem to be significantly different, which may be due in part to the unequal and small sample sizes in each site, especially the Lower Lake site. I made this graph pretty simple, although I added a note that explanins the meaning of the abreviations of the site names, and I added errorbars to determine statistical significance.

ggplot(data=ps, mapping=aes(x=Site, y=Concentration_pg_g)) +
  stat_summary(fun=mean, geom="bar", fill="bisque", color="black") +
  stat_summary(fun.data=mean_cl_normal, geom="errorbar", width=0.1) +
  scale_x_discrete(expand=expansion(0,0.5)) +
  scale_y_continuous(name="Average Concentration of GCM (pg/g)", expand=expansion(0,0.05), limits=c(0,7500)) +
  annotate(geom="label", x=3, y=6000, label="CG=Cable Gate
LL=Long Lake
WK=West Knoll") +
  labs(title="Average Concentration of GCM in Pika Feces 
Across Sites", subtitle="Unit=pg/g", caption="source: https://portal.lternet.edu/nis/metadataviewer?packageid=knb-lter-nwt.268.1") +
  theme_bw() +
  theme(panel.grid.major.x=element_blank(), panel.grid.minor.x=element_blank(), axis.title=element_blank())
#R> Warning: Removed 24 rows containing non-finite values (stat_summary).

#R> Warning: Removed 24 rows containing non-finite values (stat_summary).

Habitat Factors at each site

This data set is also from “Physiological stress of American pika (Ochotona princeps) and associated habitat characteristics for Niwot Ridge, 2018 - 2019” by Whipple and Ray. This one in particular is looking at the differences in different types of cover in each of the sites, which affects how much territory pikas can have, and therefore theoretically how stressed they may be. As seen in this diagram, every site has a high average percentage cover of rocks, with the Cable Gate site having the most. The West Knoll site has the most average percentage of forbs and grass cover, and it has no shrub or tree coverage. I chose to facet the graphs by site to compare the average percent coverage of each type of cover across the sites. I colored the bars by the cover type to further distinguish them and make them look visually appealing. Lastly, I changed the angle of the x-axis labels because they were crowded otherwise.

ggplot(data=hf, mapping=aes(x=Cover_Type, y=Mean_Perc_Cover)) +
  geom_bar(stat="identity", aes(fill=Cover_Type), color="black") +
  facet_wrap(vars(Site), labeller=labeller(Site=site_labs)) +
  scale_fill_manual(values=c("Bisque", "goldenrod1", "darkolivegreen1","gray55", "darkolivegreen4", "forestgreen")) +
  scale_x_discrete(name="Cover Type") +
  scale_y_continuous(name="Mean Percent Cover", expand=expansion(0,0.05), limits=c(0,70)) +
    labs(title="Average Percent Cover-Type Across Sites", caption="source: https://portal.lternet.edu/nis/metadataviewer?packageid=knb-lter-nwt.268.1") +
  theme_bw() +
  theme(axis.text.x=element_text(angle=45, vjust=.8), panel.grid.major.x=element_blank(), panel.grid.minor.x=element_blank(), legend.position="none", axis.title=element_blank())