In the ‘plot()’ functions below, use the col argument for lines, bor for polygon border colors. Using the ogrInfo() and readOGR functions from rgdal eliminates the necessity of selecting the appropriate function in maptools. # Natural Earth shape files - global (Robinson) projections # get shapefiles from shape_path <- "/Users/bartlein/Projects/ESSD/data/RMaps/source/" coast_shapefile <- paste(shape_path, "ne_50m_coastline/ne_50m_coastline.shp", sep= "") ocean_shapefile <- paste(shape_path, "ne_50m_ocean/ne_50m_ocean.shp", sep= "") admin0_shapefile <- paste(shape_path, "ne_50m_admin_0_countries/ne_50m_admin_0_countries.shp", sep= "") admin1_shapefile <- paste(shape_path, "ne_50m_admin_1_states_provinces_lakes/ne_50m_admin_1_states_provinces_lakes.shp", sep= "") lakes_shapefile <- paste(shape_path, "ne_50m_lakes/ne_50m_lakes.shp", sep= "") bb_shapefile <- paste(shape_path, "ne_50m_graticules_all/ne_50m_wgs84_bounding_box.shp", sep= "") grat30_shapefile <- paste(shape_path, "ne_50m_graticules_all/ne_50m_graticules_30.shp", sep= "")īefore reading each file, determine what kind it is (e.g. lines vs. polygons), then read and plot it. There are two general steps in the production of this map, the first involves 1) projecting the Natural Earth shapefiles into the Robinson projection (which are reusable for other applications), and the second the projection of the data and assembly into the finished map. This first example recreates Figure 1 from Marlon, J.R., et al., 2016, Reconstructions of biomass burning from sediment-charcoal records to improve data–model comparisons. ![]() The examples here use a set of shapefiles downloaded from the Natural Earth web page. ![]() ![]() However, the ability of the sp and rgdal packages to handle the diverse kinds of spatial data, including shapefiles, provides a facility for creating publishable maps. Other options exit, for example, using packages like ggmaps, mapview, or mapmate. R has the ability through the maps package and the base graphics to generate maps, but such “out-of-the-box” maps, like other base graphics-generated illustrations, these may not be suitable for immediate publication.
0 Comments
Leave a Reply. |