Coral Reef Bleaching

1.Start with some coral reef data
 library (rgdal)
 library (rgeos)

cb <- read.csv("CoralBleaching.csv")

2.Read in reef data with latitudes and longitudes
 b <- ggplot(cb, aes(LON, LAT)) + coord_cartesian(ylim=c(-40, 40), xlim=c(-200, 200))
 b + geom_point()
 b + geom_point(aes(color=cb$BLEACHING_SEVERITY))+scale_colour_brewer("Bleaching Severity", palette="PiYG")+ coord_equal(ratio=1)


3. Add in a shapefile of coastlines
 coast <-readOGR("ne_50m_coastline.shp", layer="ne_50m_coastline")
 ggplot() + geom_polygon(data=coast, aes(x=long, y=lat, group=group))

4. Add your point data on the map and color according to bleaching severity
 ggplot() + geom_polygon(data=coast aes(x=long, y=lat, group=group), fill="grey40",
 colour="grey90", alpha=1)+labs(x="", y="", title="Coral Reef Bleaching")+ #labels
 theme(axis.ticks.y = element_blank(),axis.text.y = element_blank(),
 plot.title = element_text(lineheight=.8, face="bold", vjust=1))+space
 geom_point(aes(x=LON, y=LAT, color=BLEACHING_SEVERITY), data=cb, alpha=1, size=3, color="grey20")+geom_point(aes(x=LON, y=LAT, color=BLEACHING_SEVERITY), data=cb, alpha=1, size=2)+scale_colour_brewer("Bleaching Severity",
 palette="PiYG")+ coord_equal(ratio=1)



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s