devtools::load_all() devtools::install_github("LiamDBailey/MyFuncs") library(ggplot2) library(dplyr) library(MyFuncs) library(extrafont)
#Load data data("Nest_elevation") #Winsorise data to deal with sea wall for(i in 1:nrow(Nest_elevation)){ if(Nest_elevation$Z[i] > 350){ Nest_elevation$Z2[i] <- 350 } else { Nest_elevation$Z2[i] <- Nest_elevation$Z[i] } } #Transform elevation values into cm above MHT in 1971 Nest_elevation$Z3 <- Nest_elevation$Z2 - 90 #Remove all individuals where no status is listed. Nest_elevation <- subset(Nest_elevation, Status != "")
Create plot
ggplot(Nest_elevation, aes(x = Z3))+ geom_density(aes(fill = Status), alpha = 0.5, colour = "black", size = 1)+ theme_ubuntu()+ theme(text = element_text(family = "sans"))+ scale_fill_manual(values = c("dark grey", "white"))+ xlab("Nest elevation (cm above 1971 mean tide)")+ ylab("Kernel density")+ scale_x_continuous(breaks = seq(0, 300, 50))
ggsave("../plots/Figure_S1.pdf", width = 20, height = 12, units = "cm", dpi = 600)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.