# Supplementary information # Code for: Increased summer food supply decreases migration distance in black-legged kittiwakes # Authors: Shannon Whelan*, Scott A. Hatch, David B. Irons, Alyson McKnight, Kyle H. Elliott # Submitted: 1 Oct 2019 # *Code author: Shannon Whelan (shannon.whelan2@mail.mcgill.ca) # Load required packages ---- # Data management library(sp) library(lubridate) library(plyr) # Statistics library(lme4) library(lmerTest) library(pbkrtest) library(rptR) # Mapping library(adehabitatHR) library(ggplot2) library(ggmap) library(maps) library(mapdata) library(maptools) library(grid) devtools::install_github("3wen/legendMap") # Import data ---- setwd("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Final Upload") deploy <- read.csv("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Final Upload/Whelan et al. BL Individual Data.csv") #### Note: I 'wrote to csv' movement metrics/dates; see commented out sections for calculations # deploy$final.fledge <- pmax(deploy$A.JFD, deploy$B.JFD,deploy$C.JFD, na.rm = TRUE) myLocs <- read.csv("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Whelan et al. Movement Data.csv") myLocs$Timestamp <- as.POSIXct(myLocs$time.1, format = "%d-%m-%Y %H:%M", tz = "GMT") # deploy$A.egg.lay.date <- as.POSIXct(deploy$A.egg.lay.date, format = "%d-%m-%Y", tz = "GMT") # deploy$A.JLD <- as.numeric(strftime(deploy$A.egg.lay.date, format = "%j")) # Response variable: lay date for single or final clutch # deploy$A.chick.fledge.date <- as.POSIXct(deploy$A.chick.fledge.date, format = "%d-%b", tz = "GMT") # deploy$A.JFD <- as.numeric(strftime(deploy$A.chick.fledge.date, format = "%j")) # Date single or first chick fledged # deploy$B.chick.fledge.date <- as.POSIXct(deploy$B.chick.fledge.date, format = "%d-%b", tz = "GMT") # deploy$B.JFD <- as.numeric(strftime(deploy$B.chick.fledge.date, format = "%j")) # Date second chick fledged # deploy$final.fledge <- pmax(deploy$A.JFD, deploy$B.JFD, na.rm = TRUE) # Response variable: fledge date # Within-season effects of food supplementation on life history traits ---- # Model first egg date ld1 <- lmer(A.JLD ~ Treatment + (1|Band) + (1|Year), data = deploy) ld2 <- lmer(A.JLD ~ (1|Band) + (1|Year), data = deploy) summary(ld1) drop1(ld1, ddf = 'Kenward-Roger') # Figure 1A ldplot <- ggplot(deploy,aes(x = Treatment, y = A.JLD, colour = Treatment))+ geom_jitter(aes(x = deploy$Treatment, y = deploy$A.JLD, colour = Treatment), width = .1) + #geom_linerange(position=position_dodge(width=0.8))+ scale_colour_manual(values = c("turquoise3", "salmon"))+ geom_point(aes(1, 146.717), colour = "black") + geom_point(aes(2, 150.064), colour = "black") + ylim(c(135, 175))+ geom_segment(aes(x = 1, y = 145.532, xend = 1, yend = 147.902), colour = "black", cex = 0.4) + geom_segment(aes(x = 2, y = 148.879, xend = 2, yend = 151.249), colour = "black", cex = 0.4) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.border = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Treatment") + ylab("Laying date (day of year)") + scale_x_discrete(name = "Treatment", labels = c("food-supplemented", "control")) # Model number of fledglings fn1 <- glmer(NumChicks ~ Treatment + (1|Band) + (1|Year), family = "poisson", data = deploy) fn2 <- glmer(NumChicks ~ (1|Band) + (1|Year), family = "poisson", data = deploy) anova(fn1,fn2) summary(fn1) # Model fledging date ff <- subset(deploy, AnyChick == "Y") ff1 <- lmer(final.fledge ~ Treatment + (1|Band) + (1|Year), data = ff) ff2 <- lmer(final.fledge ~ (1|Band) + (1|Year), data = ff) summary(ff1) drop1(ff1, ddf = 'Kenward-Roger') # Figure 1B fdplot <- ggplot(ff,aes(x = Treatment, y = final.fledge, colour = Treatment))+ geom_jitter(aes(x = ff$Treatment, y = ff$final.fledge, colour = Treatment), width = .1) + #geom_linerange(position=position_dodge(width=0.8))+ scale_colour_manual(values = c("turquoise3", "salmon")) + geom_point(aes(1, 218.275), colour = "black") + # estimate from LMM geom_point(aes(2, 220.876), colour = "black") + # estimate from LMM ylim(c(205, 245))+ geom_segment(aes(x = 1, y = 217.149, xend = 1, yend = 219.401), colour = "black", cex = 0.4) + geom_segment(aes(x = 2, y = 219.75, xend = 2, yend = 222.002), colour = "black", cex = 0.4) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Treatment") + ylab("Final fledge date (day of year)") + scale_x_discrete(name = "Treatment", labels = c("food-supplemented", "control")) library(gridExtra) grid.arrange(ldplot, fdplot, ncol = 2, nrow = 1) # Body condition at deployment ---- # bc.lm <- lm(Weight ~ Skull, data = deploy.bci) # Skull is mean skull measurement for that bird, when multiple measures taken # deploy.bci$BCI <- residuals(bc.lm) # dat.BCI <- data.frame(deploy.bci$bandYear, deploy.bci$BCI) # names(dat.BCI) <- c("bandYear", "BCI") # deploy <- merge(deploy, unique(dat.BCI), by = "bandYear", all.x = TRUE, all.y = FALSE); nrow(deploy) # nrow(distinct(deploy)) # Model body condition in response to treatment/sex bc1 <- lmer(BCI ~ Treatment + Sex + (1|Band) + (1|Year), data = deploy) # convergence warning, but no singular fits -- likely due to complex random structure, but necessary to avoid pseudoreplication, so leaving it in #bc1 <- lmer(BCI ~ Treatment + Sex + (1|Band), data = deploy) # estimates/results very similar drop1(bc1, ddf = "Kenward-Roger") summary(bc1) # Prep movement data for analyses ---- # Convert lat lon to UTM # LongLatToUTM<-function(x,y,zone){ # xy <- data.frame(ID = 1:length(x), X = x, Y = y) # coordinates(xy) <- c("X", "Y") # proj4string(xy) <- CRS("+proj=longlat +datum=WGS84") ## for example # res <- spTransform(xy, CRS(paste("+proj=utm +zone=",zone," ellps=WGS84",sep=''))) # return(as.data.frame(res)) # } # myLocs$Easting <- LongLatToUTM(myLocs$Meanlon, myLocs$Meanlat, 6)[,2] # myLocs$Northing <- LongLatToUTM(myLocs$Meanlon, myLocs$Meanlat, 6)[,3] # # # Coordinates for the colony # ColonyEasting <- 538140 # ColonyNorthing <- 6588965 # # # Calculate distance from the colony for each data point # myLocs$ColDist <- sqrt((myLocs$Easting - ColonyEasting)^2 + (myLocs$Northing - ColonyNorthing)^2)/1000 # Calculate and model distance traveled ---- # trim1 <- subset(myLocs, yday >= 212) # Latest tag deployment was 1 Aug (yday = 212) # trim2 <- subset(myLocs, yday <= 101) # Earliest tag retrieval was 12 April (yday = 101) # trim <- rbind(trim1, trim2) # # dist <- aggregate(trim$Distance~trim$tagYear, FUN = "sum") # names(dist) <- c("tagYear", "Distance") # deploy$Year <- as.factor(deploy$Year) # dist$tagYear <- as.character(dist$tagYear) # dist$Distance <- as.character(dist$Distance) # nrow(dist) includes tags with unknown bird ID # # # Append distance to main dataframe # deploy$Distance <- rep(NA,nrow(deploy)) # deploy$Distance[deploy$tagYear%in%dist$tagYear]<-(sapply(deploy$tagYear[deploy$tagYear%in%dist$tagYear],function(x)unlist(dist$Distance[dist$tagYear==x]))) # head( deploy) # deploy$Distance <- as.numeric(deploy$Distance) # # Subset data for complete cases of distance newdat <- subset(deploy, !is.na(Distance) & !is.na(Treatment) & !is.na(Sex) & !is.na(AnyChick) & !is.na(Year)) nrow(deploy); nrow(newdat) # 63 birds with distance data # Model distance travelled model1.2 <- lmer(as.numeric(Distance)~ AnyChick+Treatment+Sex + AnyChick*Treatment+(1|Band) + (1|Year), data = newdat) drop1(model1.2, ddf = "Kenward-Roger") # Interaction non sig, so drop summary(model1.2) model1.1 <- lmer(as.numeric(Distance)~ AnyChick+Sex+Treatment + (1|Band) + (1|Year), data = newdat) drop1(model1.1, ddf = "Kenward-Roger") summary(model1.1) # Calculate repeatability rep1 <- rpt(as.numeric(Distance)~ AnyChick+Sex+Treatment + (1|Band) + (1|Year), grname = c("Band","Year"), data = newdat, datatype = "Gaussian", nboot = 1000, npermut = 0) print(rep1) # Figure 2C dtplot <- ggplot(newdat,aes(x = Treatment, y = as.numeric(Distance), colour = Treatment))+ geom_jitter(aes(x = newdat$Treatment, y = as.numeric(newdat$Distance), colour = Treatment), width = .1) + #geom_linerange(position=position_dodge(width=0.8))+ scale_colour_manual(values = c("turquoise3", "salmon")) + geom_point(aes(1, 8113.83), colour = "black") + # estimate from LMM geom_point(aes(2, 10674.01), colour = "black") + # estimate from LMM #ylim(c(195, 235))+ geom_segment(aes(x = 1, y = 7303.6, xend = 1, yend = 8924.06), colour = "black", cex = 0.4) + geom_segment(aes(x = 2, y = 9863.78, xend = 2, yend = 11484.24), colour = "black", cex = 0.4) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Treatment") + ylab("Distance travelled during non-breeding season (km)") + scale_x_discrete(name = "Treatment", labels = c("food-supplemented", "control")) # Determine departure date, i.e. 3 degrees longitude from colony) ---- # tagY <- unique(myLocs$tagYear) # # # For first bird # # oneDep <- subset(myLocs, tagYear == tagY[1]) # oneDep$Real.time <- as.POSIXct(oneDep$Real.time, format = "%d-%m-%Y %H:%M", tz = "GMT") # # minDate <- min(oneDep$Real.time) # depWin <- subset(oneDep, Real.time <= (minDate + 15*24*60*60)) # depLon <- median(depWin$Meanlon) # oneDep$dep <- abs(oneDep$Meanlon - depLon) # depDat <- subset(oneDep, dep >= 3 ) # departure.date <- min(depDat$Real.time) # # maxDate <- max(as.POSIXct(oneDep$Real.time, format = "%d-%m-%Y %H:%M", tz = "GMT")) # arrWin <- subset(oneDep, Real.time >= (maxDate - 10*24*60*60)) # arrLon <- median(arrWin$Meanlon) # oneDep$arr <- abs(oneDep$Meanlon - depLon) # arrDat <- subset(oneDep, arr >= 3 ) # arrival.date <- max(arrDat$Real.time) # # sum.onedep <- data.frame(tagY[1], depLon, as.POSIXct(departure.date, format = "%Y-%m-%d"), arrLon, as.POSIXct(arrival.date, format = "%Y-%m-%d")) # names(sum.onedep) <- c("tagYear", "depLon", "depDat", "arrLon", "arrDat") # # migration.summary <- data.frame(tagY[1], depLon, as.POSIXct(departure.date, format = "%Y-%m-%d"), arrLon, as.POSIXct(arrival.date, format = "%Y-%m-%d")) # names(migration.summary) <- c("tagYear", "depLon", "depDat", "arrLon", "arrDat") # # # For all birds # # for (i in 1:length(tagY)) { # oneDep <- subset(myLocs, tagYear == tagY[i]) # oneDep$Real.time <- as.POSIXct(oneDep$Real.time, format = "%d-%m-%Y %H:%M", tz = "GMT") # # minDate <- min(oneDep$Real.time) # depWin <- subset(oneDep, Real.time <= (minDate + 15*24*60*60)) # depLon <- median(depWin$Meanlon) # oneDep$dep <- oneDep$Meanlon - depLon #abs(oneDep$Meanlon - depLon) # depDat <- subset(oneDep, dep >= 3 ) # departure.date <- min(depDat$Real.time) # # maxDate <- max(as.POSIXct(oneDep$Real.time, format = "%d-%m-%Y %H:%M", tz = "GMT")) # arrWin <- subset(oneDep, Real.time >= (maxDate - 10*24*60*60)) # arrLon <- median(arrWin$Meanlon) # oneDep$arr <- oneDep$Meanlon - depLon #abs(oneDep$Meanlon - depLon) # arrDat <- subset(oneDep, arr >= 3 ) # arrival.date <- max(arrDat$Real.time) # # sum.onedep <- data.frame(tagY[i], depLon, as.POSIXct(departure.date, format = "%Y-%m-%d"), arrLon, as.POSIXct(arrival.date, format = "%Y-%m-%d")) # names(sum.onedep) <- c("tagYear", "depLon", "depDat", "arrLon", "arrDat") # migration.summary <- rbind(migration.summary, sum.onedep) # # } # # length(migration.summary[,1]) # migration.summary <- migration.summary[-1,] # # deploy <- merge(deploy, migration.summary, by = "tagYear", all.x =TRUE) # deploy$depJLD <- as.numeric(strftime(deploy$depDat, format = "%j")) # deploy$arrJLD <- as.numeric(strftime(deploy$arrDat, format = "%j")) # # hist(deploy$depJLD, breaks = 30) # hist(deploy$arrJLD, breaks = 30) # # deploy$departure <- deploy$depJLD # deploy$arrival <- deploy$arrJLD # # Identify migratory (Yes) and atypical (No) birds ---- # deploy$Migratory <- "Yes" # As default, to start # deploy$Migratory[is.na(deploy$Distance)] <- "NA" # No movement data # subset(deploy, !is.na(deploy$Distance) & is.na(deploy$departure)) # these two stayed within 3 deg longitude of MDO # deploy$Migratory[!is.na(deploy$Distance) & is.na(deploy$departure)] <- "No" # hist(deploy$arrJLD, breaks = 20); subset(deploy, Migratory == "Yes" & arrJLD >=200) # deploy$Migratory[deploy$arrJLD >=200] <- "No" # these nine ame back to the colony during winter (i.e. before 1 Jan) # hist(deploy$depJLD, breaks = 20); subset(deploy, depJLD <=150) # deploy$Migratory[deploy$depJLD <=150] <- "No" # these two left MDO after fall/during "winter" (i.e. 1 Jan) # hist(deploy$depJLD, breaks = 40); subset(deploy, depJLD >=320) # deploy$Migratory[deploy$depJLD >=320] <- "No" # this one left MDO after fall/during "winter" (i.e. after normalish distribution of departures, or in Jan # Reviewer 2 asked for chi-sq test for propensity to migrate ---- # A proper model will not fit (see commented code below) # newdat <- subset(deploy, !is.na(Migratory) &!is.na(Distance) & !is.na(Treatment) & !is.na(Sex) & !is.na(AnyChick) & !is.na(Year)); nrow(newdat) # no distance = no movement data # newdat$migratory <- ifelse(newdat$Migratory == "Yes", 1, 0) # mig.mod1 <- glmer(migratory ~ AnyChick+Treatment+Sex + AnyChick*Treatment+(1|Band) + (1|Year), family = binomial, data = newdat) # mig.mod2 <- glmer(migratory ~ AnyChick+Treatment+Sex+(1|Band) + (1|Year), family = binomial, data = newdat) # anova(mig.mod1,mig.mod2) #interaction non-sig, so remove # mig.mod2 <- glmer(migratory ~ AnyChick+Treatment+Sex+(1|Band) + (1|Year), family = binomial, data = newdat) #fits ok # mig.mod3 <- glmer(migratory ~ AnyChick+Sex+(1|Band) + (1|Year), family = binomial, data = newdat) #singular fit # mig.mod4 <- glmer(migratory ~ AnyChick+Treatment+(1|Band) + (1|Year), family = binomial, data = newdat) #fits ok # mig.mod5 <- glmer(migratory ~ Treatment+Sex+(1|Band) + (1|Year), family = binomial, data = newdat) #Fails to converge # Better to do a simple chi-sq, ignoring other factors mig.sum <- aggregate(newdat$Year ~ newdat$Treatment + newdat$Migratory, FUN = "length" ) chisq.test(newdat$Treatment, newdat$Migratory, correct = FALSE) # Model fall departure dates ---- newdat <- subset(deploy, Migratory == "Yes" & !is.na(departure) & !is.na(Treatment) & !is.na(Sex) & !is.na(AnyChick) & !is.na(Year)) nrow(deploy); nrow(newdat) # 48 birds # Model autumn departure dates model2.1 <- lmer(departure~AnyChick+Treatment+Sex+AnyChick*Treatment+(1|Band)+(1|Year), data = newdat) drop1(model2.1, ddf = "Kenward-Roger") summary(model2.1) rep1.1 <- rpt(departure~ AnyChick+Sex+Treatment+AnyChick*Treatment + (1|Band) + (1|Year), grname = c("Band","Year"), data = newdat, datatype = "Gaussian", nboot = 1000, npermut = 0) print(rep1.1) # Figure 2B p <- ggplot(newdat, aes(x = AnyChick, y = departure, colour = Treatment)) + geom_smooth(method = "lm") + geom_jitter(width = .1) + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position=c(0,1), legend.justification=c(-.2,1))+ scale_x_discrete(name = "Fledging success", labels = c("no", "yes")) + scale_colour_manual(values = c("turquoise3", "salmon"), labels = c("food-supplemented", "control")) + ylab("Date of departure from colony") print(p) grid.arrange(p, dtplot, nrow = 1, ncol = 2) # Model spring arrival dates ---- newdat <- subset(deploy, Migratory == "Yes" & !is.na(arrival) & !is.na(Treatment) & !is.na(Sex) & !is.na(AnyChick) & !is.na(Year)) nrow(deploy); nrow(newdat) # 48 birds model3.0 <- lmer(arrival~AnyChick+Treatment+Sex+AnyChick*Treatment+(1|Band)+(1|Year), data = newdat) # Singular fit, must simplify model3.0 <- lmer(arrival~AnyChick+Treatment+Sex+(1|Band)+(1|Year), data = newdat) # Singular fit, must simplify model3.1 <- lmer(arrival~AnyChick+Treatment+(1|Band)+(1|Year), data = newdat) drop1(model3.1, ddf = "Kenward-Roger") summary(model3.1) rep1.2 <- rpt(arrival~ AnyChick+Treatment+ (1|Band) + (1|Year), grname = c("Band","Year"), data = newdat, datatype = "Gaussian", nboot = 1000, npermut = 0) print(rep1.2) # Supplementary Figure 2 ggplot(newdat, aes(x = Treatment, y = as.numeric(arrival),fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ geom_boxplot() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + #xlab("Treatment") + ylab("Spring arrival date (day of year)") + scale_x_discrete(name = "Treatment", labels = c("food-supplemented", "control")) #################Figure 2 Map#################### # Utilisation distributions and map ---- # Create index for deployment Treatment <- data.frame(deploy$tagYear, deploy$Treatment) names(Treatment) <- c("tagYear", "Food") # Attach index to location data myLocsHR <- merge(myLocs, Treatment, by = as.character("tagYear")) # Subset location estimates for nonbreeding movement trimHR1 <- subset(myLocsHR, yday >= 212) # Latest tag deployment was 1 Aug (yday = 212) trimHR2 <- subset(myLocsHR, yday <= 101) # Earliest tag retrieval was 12 April (yday = 101) trimHR <- rbind(trimHR1, trimHR2) str(trimHR) #How many locations per non-breeding track aggregate(trimHR$yday ~ trimHR$tagYear, FUN = "length" ) # Range = 506-510, i.e. not imbalanced by treatment # Prepare data for adehabitatHR functions coordinates(trimHR) <- c("Longitude", "Latitude") proj4string(trimHR) <- CRS("+proj=longlat +datum=WGS84") trimHR <- spTransform(trimHR, CRS("+proj=utm +zone=6 ellps=WGS84")) # Home range for food-supplemented birds fedHR<- subset(trimHR, Food == "fed") kd <- kernelUD(fedHR) UD1 <- getverticeshr(kd, percent = 95) plot(UD1) UD1$group <- paste(UD1$group,"fed",sep="") # Home range for control birds unfedHR<- subset(trimHR, Food == "unfed") kd <- kernelUD(unfedHR) UD2 <- getverticeshr(kd, percent = 95) plot(UD2) UD2$group <- paste(UD2$group,"unfed",sep="") # Make scale bar create_scale_bar <- function(lon,lat,distance_lon,distance_lat,distance_legend, dist_units = "km"){ # First rectangle bottom_right <- gcDestination(lon = lon, lat = lat, bearing = 90, dist = distance_lon, dist.units = dist_units, model = "WGS84") topLeft <- gcDestination(lon = lon, lat = lat, bearing = 0, dist = distance_lat, dist.units = dist_units, model = "WGS84") rectangle <- cbind(lon=c(lon, lon, bottom_right[1,"long"], bottom_right[1,"long"], lon), lat = c(lat, topLeft[1,"lat"], topLeft[1,"lat"],lat, lat)) rectangle <- data.frame(rectangle, stringsAsFactors = FALSE) # Second rectangle t right of the first rectangle bottom_right2 <- gcDestination(lon = lon, lat = lat, bearing = 90, dist = distance_lon*2, dist.units = dist_units, model = "WGS84") rectangle2 <- cbind(lon = c(bottom_right[1,"long"], bottom_right[1,"long"], bottom_right2[1,"long"], bottom_right2[1,"long"], bottom_right[1,"long"]), lat=c(lat, topLeft[1,"lat"], topLeft[1,"lat"], lat, lat)) rectangle2 <- data.frame(rectangle2, stringsAsFactors = FALSE) # Now let's deal with the text on_top <- gcDestination(lon = lon, lat = lat, bearing = 0, dist = distance_legend, dist.units = dist_units, model = "WGS84") on_top2 <- on_top3 <- on_top on_top2[1.5,"long"] <- bottom_right[1.5,"long"] on_top3[1.5,"long"] <- bottom_right2[1.5,"long"] legend <- rbind(on_top, on_top2, on_top3) legend <- data.frame(cbind(legend, text = c(0, distance_lon, distance_lon*2)), stringsAsFactors = FALSE, row.names = NULL) return(list(rectangle = rectangle, rectangle2 = rectangle2, legend = legend)) } create_orientation_arrow <- function(scale_bar, length, distance = 1, dist_units = "km"){ lon <- scale_bar$rectangle2[1,1] lat <- scale_bar$rectangle2[1,2] # Bottom point of the arrow beg_point <- gcDestination(lon = lon, lat = lat, bearing = 0, dist = distance, dist.units = dist_units, model = "WGS84") lon <- beg_point[1,"long"] lat <- beg_point[1,"lat"] # Let us create the endpoint on_top <- gcDestination(lon = lon, lat = lat, bearing = 0, dist = length, dist.units = dist_units, model = "WGS84") left_arrow <- gcDestination(lon = on_top[1,"long"], lat = on_top[1,"lat"], bearing = 225, dist = length/5, dist.units = dist_units, model = "WGS84") right_arrow <- gcDestination(lon = on_top[1,"long"], lat = on_top[1,"lat"], bearing = 135, dist = length/5, dist.units = dist_units, model = "WGS84") res <- rbind( cbind(x = lon, y = lat, xend = on_top[1,"long"], yend = on_top[1,"lat"]), cbind(x = left_arrow[1,"long"], y = left_arrow[1,"lat"], xend = on_top[1,"long"], yend = on_top[1,"lat"]), cbind(x = right_arrow[1,"long"], y = right_arrow[1,"lat"], xend = on_top[1,"long"], yend = on_top[1,"lat"])) res <- as.data.frame(res, stringsAsFactors = FALSE) # Coordinates from which "N" will be plotted coords_n <- cbind(x = lon, y = (lat + on_top[1,"lat"])/2) return(list(res = res, coords_n = coords_n)) } scale_bar <- function(lon, lat, distance_lon, distance_lat, distance_legend, dist_unit = "km", rec_fill = "white", rec_colour = "black", rec2_fill = "black", rec2_colour = "black", legend_colour = "black", legend_size = 3, orientation = TRUE, arrow_length = 500, arrow_distance = 300, arrow_north_size = 6){ the_scale_bar <- create_scale_bar(lon = lon, lat = lat, distance_lon = distance_lon, distance_lat = distance_lat, distance_legend = distance_legend, dist_unit = dist_unit) # First rectangle rectangle1 <- geom_polygon(data = the_scale_bar$rectangle, aes(x = lon, y = lat), fill = rec_fill, colour = rec_colour) # Second rectangle rectangle2 <- geom_polygon(data = the_scale_bar$rectangle2, aes(x = lon, y = lat), fill = rec2_fill, colour = rec2_colour) # Legend scale_bar_legend <- annotate("text", label = paste(the_scale_bar$legend[,"text"], dist_unit, sep=""), x = the_scale_bar$legend[,"long"], y = the_scale_bar$legend[,"lat"], size = legend_size, colour = legend_colour) res <- list(rectangle1, rectangle2, scale_bar_legend) if(orientation){# Add an arrow pointing North coords_arrow <- create_orientation_arrow(scale_bar = the_scale_bar, length = arrow_length, distance = arrow_distance, dist_unit = dist_unit) arrow <- list(geom_segment(data = coords_arrow$res, aes(x = x, y = y, xend = xend, yend = yend)), annotate("text", label = "N", x = coords_arrow$coords_n[1,"x"], y = coords_arrow$coords_n[1,"y"], size = arrow_north_size, colour = "black")) res <- c(res, arrow) } return(res) } # Figure 2A usa_map <- map_data("world") P <- ggplot(myLocs, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") #+ geom_point() P <- P + scale_x_continuous(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(10, 80)) P <- P + scale_bar(lon = -160, lat = 38, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) UD2 <- spTransform(UD2, CRS("+proj=longlat +datum=WGS84")) UD2 <- fortify(UD2) P <- P + geom_polygon(data = UD2, alpha=0.4, aes(x = long, y = lat, col = "one")) UD1 <- spTransform(UD1, CRS("+proj=longlat +datum=WGS84")) UD1 <- fortify(UD1) UD1.1 <- subset(UD1, group == "homerange.1") UD1.2 <- subset(UD1, group == "homerange.2") P <- P + geom_polygon(data = UD1.1,alpha=0.4, aes(x = long, y = lat, col = "same")) P <- P + geom_polygon(data = UD1.2, alpha=0.4, aes(x = long, y = lat, col = "same")) + scale_color_discrete(name = "Food treatment", labels = c("control", "food-supplemented")) print(P) #################Supplementary Material Figures#################### # SF1 Plot non-breeding location estimates for entire study ---- usa_map <- map_data("world") P <- ggplot(trimHR, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + geom_point( size = 0.1) P <- P + scale_x_continuous(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(10, 80)) P <- P + scale_bar(lon = -160, lat = 38, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) print(P) # SF2 Code is above, to ensure proper subsetting ---- # SF3 Daily proportion time spent dry and daily distance travelled, by year ---- propObs <- read.csv("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Whelan et al. Daily Conductivity.csv") deploy <- read.csv("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Whelan et al. Individual Data.csv") deploy$tagYear <- paste(deploy$Geolocator, deploy$Year, sep = "_") wdsum <- merge(propObs, deploy, by = "tagYear", all.x = TRUE) p10 <- ggplot(data = wdsum[wdsum$Year == 2010,], aes(x = DSD, y = propDry, fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ scale_color_manual(values = c("turquoise3", "salmon"))+ geom_point(aes(x = DSD, y = propDry), col = "grey")+ geom_smooth(aes(x = DSD, y = propDry, color = Treatment, fill = Treatment)) + geom_vline(xintercept = 40, linetype = 'dashed', color = 'grey')+ geom_vline(xintercept = 257, linetype = 'dashed', color = 'grey')+ ylim(0, 0.85)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = c(0.85, 0.8), axis.title.x=element_blank()) + ylab("Proportion of time dry (%)") p11 <- ggplot(data = wdsum[wdsum$Year == 2011,], aes(x = DSD, y = propDry, fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ scale_color_manual(values = c("turquoise3", "salmon"))+ geom_point(aes(x = DSD, y = propDry), col = "grey")+ geom_smooth(aes(x = DSD, y = propDry, color = Treatment, fill = Treatment)) + geom_vline(xintercept = 22, linetype = 'dashed', color = 'grey')+ geom_vline(xintercept = 255, linetype = 'dashed', color = 'grey')+ ylim(0, 0.85)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = c(0.85, 0.8), axis.title.x=element_blank()) + ylab("Proportion of time dry(%)") ########## myLocs <- read.csv("~/Documents/Publications/Submitted/Biology Letters (02.10.2019)/Whelan et al. Movement Data.csv") myLocs$Timestamp <- as.POSIXct(myLocs$Real.time, format = "%d-%m-%Y %H:%M", tz = "GMT") myLocs$DOY <- as.numeric(strftime(myLocs$Timestamp, format = "%j")) #trim to non-breeding trim1 <- subset(myLocs, DOY >= 212) # Latest tag deployment was 1 Aug (yday = 212) trim2 <- subset(myLocs, DOY <= 101) # Earliest tag retrieval was 12 April (yday = 101) trimDD <- rbind(trim1, trim2) trimDD$DSD <- NA trimDD$DSD[trimDD$DOY < 102] <- trimDD$DOY[trimDD$DOY < 102] + 154 trimDD$DSD[trimDD$DOY > 211] <- trimDD$DOY[trimDD$DOY > 211] - 211 distObs <- ddply(trimDD, c("tagYear", "DSD"), summarize, dayDist = sum(Distance) ) ddsum <- merge(wdsum, distObs, by = c("tagYear", "DSD"), all.x = TRUE) d10 <- ggplot(data = ddsum[ddsum$Year == 2010,], aes(x = DSD, y = dayDist, fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ scale_color_manual(values = c("turquoise3", "salmon"))+ #geom_point(aes(x = DSD, y = dayDist), col = "grey")+ geom_smooth(aes(x = DSD, y = dayDist, color = Treatment, fill = Treatment)) + #geom_line(aes(x = DSD, y = dayDist, group = tagYear))+ geom_vline(xintercept = 40, linetype = 'dashed', color = 'grey')+ geom_vline(xintercept = 257, linetype = 'dashed', color = 'grey')+ #ylim(0, 20)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Days since Jul 30") + ylab("Distance travelled (km/d)") d11 <- ggplot(data = ddsum[ddsum$Year == 2011,], aes(x = DSD, y = dayDist, fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ scale_color_manual(values = c("turquoise3", "salmon"))+ #geom_point(aes(x = DSD, y = dayDist), col = "grey")+ geom_smooth(aes(x = DSD, y = dayDist, color = Treatment, fill = Treatment)) + geom_vline(xintercept = 22, linetype = 'dashed', color = 'grey')+ geom_vline(xintercept = 255, linetype = 'dashed', color = 'grey')+ #ylim(0, 20)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Days since Jul 30") + ylab("Distance travelled (km/d)") # SF4 Test for differences between distance travelled in autumn, winter, spring ---- fall <- subset(trimDD, DSD <= 104 & DSD >= 29) # mean(deploy$departure[!is.na(as.character(deploy$departure))]); mean departure date is 240, i.e. 29 d after Jul 30 fallDist <- ddply(fall, c("tagYear", "Year"), summarize, dayDist = sum(Distance), stage = "fall" ) wint <- subset(trimDD, DSD > 75 & DSD <152 ) wintDist <- ddply(wint, c("tagYear", "Year"), summarize, dayDist = sum(Distance), stage = "winter" ) spr <- subset(trimDD, DSD >=180 ) # mean(deploy$arrival[!is.na(as.character(deploy$arrival))]); mean arrival date is 108, i.e. 262 d after Jul 30 -- just go back 75 d from 255 since that was earliest recapture sprDist <- ddply(spr, c("tagYear", "Year"), summarize, dayDist = sum(Distance), stage = "spring" ) seas <- rbind(fallDist, wintDist, sprDist) seas <- merge(seas, deploy, by = "tagYear", all.x = TRUE) seas <- subset(seas, !is.na(Treatment) ) seas$stage = factor(seas$stage,levels = c("fall", "winter", "spring")) hist(seas$dayDist[seas$stage == "fall"]) hist(seas$dayDist[seas$stage == "winter"]) hist(seas$dayDist[seas$stage == "spring"]) hist(seas$dayDist) ggplot(data = seas, aes(x = stage, y = dayDist, fill = Treatment)) + scale_fill_manual(values = c("turquoise3", "salmon"))+ geom_boxplot()+ #geom_line(aes(x = DSD, y = dayDist, group = tagYear))+ geom_vline(xintercept = 40, linetype = 'dashed', color = 'grey')+ geom_vline(xintercept = 257, linetype = 'dashed', color = 'grey')+ #ylim(0, 20)+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank(), axis.line = element_line(colour = "black"), legend.position = 'none') + xlab("Nonbreeding stage") + ylab("Distance travelled (km)") full.mod1 <- lmer(dayDist ~ Treatment*stage + (1|Band) + (1|Year.y), data = seas) summary(full.mod1) drop1(full.mod1, method = 'Kenward-Roger') full.mod2 <- lmer(dayDist ~ Treatment+stage + (1|Band) + (1|Year.y), data = seas) summary(full.mod2) drop1(full.mod2, method = 'Kenward-Roger') # SF5 Plot 10 individuals with 2-3 y of data ---- deploy <- subset(deploy, !is.na(deploy$Geolocator)) summit <- aggregate(deploy$Year ~ deploy$Band + deploy$tagYear, FUN = "length" ) names(summit) <- c("Band", "tagYear","Years") summit <- summit[order(as.numeric(summit$Band)),] # Which birds have more than one year? summit2 <- aggregate(deploy$tagYear ~ deploy$Band, FUN = "length" ) names(summit2) <- c("Band","Years") summit2 <- summit2[order(as.numeric(summit2$Band)),] summit2 <- subset(summit2, Years >= 2) sit <- merge(summit, summit2, by = "Band") sit.loc <- merge(myLocsHR, sit, by = "tagYear") sit.loc <- sit.loc[order(sit.loc$time.1),] library(stringr) sit.loc$year <- str_sub(sit.loc$tagYear, start = -4) ggplot(sit.loc, aes(x = Longitude, y = Latitude, col = as.character(tagYear))) + geom_path() usa_map <- map_data("world") # 1 P <- ggplot(B1, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B1 <- subset(sit.loc, Band == 79426546) B1p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B1p B1p + scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 2 P <- ggplot(B2, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B2 <- subset(sit.loc, Band == 79426621) B2p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B2p + scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 3 P <- ggplot(B3, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B3 <- subset(sit.loc, Band == 79426815) B3p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B3p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 4 P <- ggplot(B4, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B4 <- subset(sit.loc, Band == 79426841) B4p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','darkgreen'), guide=FALSE) B4p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 5 P <- ggplot(B5, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B5 <- subset(sit.loc, Band == 79448170) B5p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','darkgreen'), guide=FALSE) B5p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 6 P <- ggplot(B6, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B6 <- subset(sit.loc, Band == 79448185) B6p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue', 'darkgreen'), guide=FALSE) B6p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 7 P <- ggplot(B7, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B7 <- subset(sit.loc, Band == 79448269) B7p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B7p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 8 P <- ggplot(B8, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B8 <- subset(sit.loc, Band == 79448438) B8p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B8p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 9 P <- ggplot(B9, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B9 <- subset(sit.loc, Band == 79448956) B9p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B9p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 10 P <- ggplot(B10, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B10 <- subset(sit.loc, Band == 79470779) B10p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B10p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 11 P <- ggplot(B11, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B11 <- subset(sit.loc, Band == 79448956) B11p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B11p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 12 P <- ggplot(B12, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B12 <- subset(sit.loc, Band == 79470792) B12p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','blue'), guide=FALSE) B12p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 13 P <- ggplot(B13, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B13 <- subset(sit.loc, Band == 79470833) B13p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('red','darkgreen'), guide=FALSE) B13p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 14 P <- ggplot(B14, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B14 <- subset(sit.loc, Band ==79484150) B14p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('blue','darkgreen'), guide=FALSE) B14p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 15 P <- ggplot(B15, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B15 <- subset(sit.loc, Band == 79484908) B15p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('blue','darkgreen'), guide=FALSE) B15p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE) # 16 P <- ggplot(B16, aes(x = Longitude, y = Latitude)) + geom_polygon(data = usa_map, aes(x = long, y = lat, group = group)) + coord_map("azequidistant") P <- P + scale_x_continuous(limits= c(-170, -110)) #(limits= c(-180, -100)) P <- P + scale_y_continuous(limits = c(40, 70)) #(limits = c(10, 80)) B16 <- subset(sit.loc, Band == 95405001) B16p <- P + #ggplot(B1, aes(x = Longitude, y = Latitude)) + #+ geom_point() _ geom_path(aes(x = Longitude, y = Latitude, col = as.character(year))) + scale_color_manual(values=c('blue','darkgreen'), guide=FALSE) B16p+ scale_bar(lon = -160, lat = 45, distance_lon = 500, distance_lat = 100, distance_legend = 200, legend_size = 2, dist_unit = "km", orientation = FALSE)