author: Etienne Low-Décarie
class: small-code
if(!require(ggmap)) {install.packages("ggmap")}
require(ggmap)
if(!require(maptools)) {install.packages("maptools")}
require(maptools)
class: small-code
map <- ggplot()+borders("world",
colour="gray50",
fill="gray50")
print(map)
Cheatsheet: https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/ggmap/ggmapCheatsheet.pdf
<iframe src="https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/ggmap/ggmapCheatsheet.pdf" width="1000" height="800">Your browser does not support iframes.
</iframe>bounding box lowerleftlon, lowerleftlat, upperrightlon, upperrightlat (a little glitchy for google maps)
myLocation <- with(coord, c(min(LON),
min(LAT),
max(LON),
max(LAT)))
myLocation <- c(-179,-89,179,89)
myMap <- get_map(location=myLocation,
source="stamen",
maptype="watercolor",
crop=FALSE)
myMap <- ggmap(myMap)
print(myMap)
Coral bleaching data from ReefBase http://www.reefbase.org
coord <- read.csv("./Data/CoralBleaching_cleaned.csv")
Extract bleaching events
coord <- coord[coord$BLEACHING_SEVERITY %in% c("Low","Medium","HIGH"),]
coord$BLEACHING_SEVERITY <- factor(coord$BLEACHING_SEVERITY, levels=levels(coord$BLEACHING_SEVERITY)[c(2,3,1)])
map <- map+geom_point(data=coord,aes(x=LON,
y=LAT,
colour=BLEACHING_SEVERITY),
alpha=0.5)
print(map)
map <- map+
scale_colour_manual(values = c("Low"="yellow",
"Medium"="orange",
"HIGH"="red"))+
guides(colour = guide_legend(override.aes = list(alpha = 1))) #+
#facet_grid(YEAR~.)
print(map)
print(map+facet_wrap(~YEAR))
Create a coordinate file with the location of your house and the location of the house of your friends
Produce maps from the data in Henry P, Le Lay G, Goudet J, Guisan A, Jahodová S, Besnard G (2009) Reduced genetic diversity, increased isolation and multiple introductions of invasive giant hogweed in the western Swiss Alps. Molecular Ecology 18: 2819-2831. paper data
<script src="countdown.js" type="text/javascript"></script>
<script type="application/javascript">
var myCountdown1 = new Countdown({
time: 300,
width:150,
height:80,
rangeHi:"minute" // <- no comma on last item!
});
</script>