# Script used to create distribution maps # Load required packages (install if necessary) if(!require(devtools)){ install.packages("devtools") require(devtools) } if(!require(meowR)){ install.github("meowR", "jebyrnes") require(meowR) } # Define function for creating distribution maps makeDistributionMap <- function(ecoregions, filename){ if(file.exists(filename)){ stop(paste("File exists: ", filename, sep="")) } fillCol <- rep(1, length(ecoregions)) distData <- as.data.frame(cbind(ecoregions, fillCol)) distributionMap <- makeMEOWmap(newdata=distData, fillColName="fillCol", regionColName="ecoregions", add.worldmap = T, fillPal="#377EB8", pathCol="#377EB8") ggsave(filename, width=200, height=100, units="mm") } # Get a vector of all ecoregions, so that we can check the names in our vectors of ecoregions for each species. data("regions.df") allEcoregions <- unique(regions.df$ECOREGION) # Corynosoma magdaleni magdaleniEcoregions <- c("Northern Grand Banks - Southern Labrador", "Northern Labrador", "Baffin Bay - Davis Strait", "Hudson Complex", "Lancaster Sound", "Gulf of St. Lawrence - Eastern Scotian Shelf", "Southern Grand Banks - South Newfoundland", "Scotian Shelf", "Gulf of Maine/Bay of Fundy", "Baltic Sea", "North Sea") setdiff(magdaleniEcoregions, allEcoregions) makeDistributionMap(magdaleniEcoregions, "magdaleni_map.png") # Corynosoma semerme semermeEcoregions <- c("Aleutian Islands", "Baltic Sea", "Beaufort Sea - continental coast and shelf", "Beaufort-Amundsen-Viscount Melville-Queen Maud", "Celtic Seas", "Chukchi Sea", "East Greenland Shelf", "East Siberian Sea", "Eastern Bering Sea", "Gulf of Alaska", "Gulf of St. Lawrence - Eastern Scotian Shelf", "High Arctic Archipelago", "Kara Sea", "Lancaster Sound", "Laptev Sea", "North American Pacific Fijordland", "North and East Barents Sea", "North and East Iceland", "North Greenland", "North Sea", "Northern Grand Banks - Southern Labrador", "Northern Labrador", "Northern Norway and Finnmark", "Scotian Shelf", "Sea of Okhotsk", "Southern Grand Banks - South Newfoundland", "Southern Norway", "West Greenland Shelf", "White Sea") setdiff(semermeEcoregions, allEcoregions) makeDistributionMap(semermeEcoregions, "semerme_map.png") # Corynosoma strumosum strumosumEcoregions <- c("Adriatic Sea", "Aegean Sea", "Alboran Sea", "Aleutian Islands", "Baltic Sea", "Beaufort Sea - continental coast and shelf", #"Caspian Sea", "Celtic Seas", "Central Kuroshio Current", "Central New Zealand", "Chukchi Sea", "Cortezian", "East China Sea", "East Greenland Shelf", "East Siberian Sea", "Eastern Bering Sea", "Faroe Plateau", "Gulf of Alaska", "Gulf of St. Lawrence - Eastern Scotian Shelf", "Hudson Complex", "Ionian Sea", "Kamchatka Shelf and Coast", "Kara Sea", "Laptev Sea", "Magdalena Transition", "North American Pacific Fijordland", "North and East Barents Sea", "North and East Iceland", "North Greenland", "North Sea", "Northeastern Honshu", "Northeastern New Zealand", "Northern California", "Northern Grand Banks - Southern Labrador", "Northern Labrador", "Oregon, Washington, Vancouver Coast and Shelf", "Oyashio Current", "Puget Trough/Georgia Basin", "Scotian Shelf", "Sea of Japan/East Sea", "Sea of Okhotsk", "Southern Grand Banks - South Newfoundland", "South and West Iceland", "South European Atlantic Shelf", "South New Zealand", "Southern California Bight", "Southern Grand Banks - South Newfoundland", "Southern Norway", "West Greenland Shelf", "Western Mediterranean", "White Sea", "Yellow Sea") setdiff(strumosumEcoregions, allEcoregions) makeDistributionMap(strumosumEcoregions, "strumosum_map.png")