- We first provide the aesthetics with longitude and lattitude as x and y. We also need to specify group argument to specify the state level information. Here we also fill by state. 1. 2. 3. p <- ggplot (data = us_states, mapping = aes (x = long, y = lat, group = group, fill = region))
- Over the last years ggplot2 has become the standard plotting library for many R users, especially as it keeps evolving and new features are added continuously. In addition to being more convient for certain types of plots, many feel that the default colors, axis types etc. look better on ggplot2 compared to the base R and lattice libraries.
- From the comments: here’s a comparison using the base R plotting commands. I didn’t work to match the colors because I was using default ggplot2 colors and wanted to compare with default base colors (one of the many great things about ggplot2 is pleasing default color options). Also notice the difference in tick positions and spacing.. "/>
- R basemap ggplot. A basemap was required that show the boundaries of the countries within the WIO region. The basemap that contain all african countries was used. Then load the basemap, for this post I used the basemap of Africa , which is the ESRI shapefile format. ... We have seen the power of R and ggplot2 to draw the publication quality ...
- Making Maps with GGPlot2; by Mark R Payne; Last updated over 6 years ago; Hide Comments (–) Share Hide Toolbars