Skip to content

Instantly share code, notes, and snippets.

@geneva
Created May 29, 2019 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geneva/385667eb818e0e37af601cc7d14dd376 to your computer and use it in GitHub Desktop.
Save geneva/385667eb818e0e37af601cc7d14dd376 to your computer and use it in GitHub Desktop.
Plotting Bimini
library(dplyr)
library(ggmap)
library(ggsn)
#Download map data for South Bimini
pngMAP_df <- get_map(location = c(lon = -79.275, lat = 25.71),
source = "google",
zoom = 13,
color="bw",
scale = 2)
# Define sites
lon <- c(-79.300200,-79.300200,-79.270911, -79.298205)
lat <- c(25.704172,25.705249,25.706629,25.705320 )
Habitat <- c("Coppice Forest", "Coastal Scrub","Mangrove","Secondary")
sites <- data.frame(lon,lat,Habitat)
#generate map object
BimMap <- ggmap(pngMAP_df) +
scale_shape_manual(values=c(16, 15,17, 18)) +
scale_y_continuous(limits=c(25.685, 25.72)) +
scale_x_continuous(limits=c(-79.31, -79.24)) +
geom_point(aes(x=lon, y=lat, shape=Habitat), data= sites, show.legend = TRUE) +
scalebar(x.min = -79.31,
y.min= 25.685,
x.max = -79.24,
y.max= 25.72,
dist = 1, dd2km = T, model = 'WGS84',
location = "bottomleft",anchor = c(x=-79.295, y=25.688),
st.size = 3.3, st.dist = 0.05)
#plot including North arrow
pdf("Bimini.pdf")
north2(BimMap, x = 0.7, y = 0.65)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment