Scalebars and North Arrows with MapmiscSeptember 21, 2016Description: The package mapmisc is great for creating simple, fast, and effective maps; it utilizes shorter, neater coding at the cost of being less customizable than some other mapping packages. This R-Tip is modified from: https://cran.r-project.org/web/packages/mapmisc/vignettes/mapmisc.pdf First, let’s install and load some packages that we’ll be using in this R-Tip, including the mapmisc package.
Let’s download regional shapefiles for the US. You can download the file cb_2014_us_region_20m.shp from this website: http://www2.census.gov/geo/tiger/GENZ2014/shp/ Let’s open the shapefiles in R and read them in:
Next, we’ll define the shapefile’s projection, and since we’re dealing with a map of the US, we’ll reproject the shapefile using the US National Atlas equal-area projection.
Now, we can add a scaleBar and north arrow easily with mapmisc. scaleBar() is particularly user-friendly because it automatically generates the scale and true north based on the projection settings of the object you provide.
In the map above, we can see scaleBar seems to have taken one of the extremes for the north arrow; as I mentioned at the beginning, mapmisc is user friendly, but it does take away some options to customize your map, and with such a large extent being mapped, this north arrow may not be ideal. For fun, let’s try that again, this time with just the northeast. The north arrow will be able to represent true north better for a smaller area.
scaleBar is a very user-friendly command from the package mapmisc that can help you easily enhance your maps. Keep in mind some of the shortcomings discussed when choosing to use this command.
0 Comments
Leave a Reply. |
Spatial Ecology @ MSUClick on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870) Category
All
Archive
October 2016
|