In pursuit of replicability (as well as requirements of funding agency), I am trying to produce all of the maps for a current project in R.
For single attribute maps, so far so good! I am using ggplot2 and enjoying all of the customization options.
However, I'm running into problems as to how I can make multiple attribute maps. In GIS terms, I'm interested in having one graduated color layer and one proportional symbol layer. Here is an example of the current code:
mapPlot <- ggplot(data) + theme_void() + theme(plot.background = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.border = element_blank() ,axis.title = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), legend.position="bottom", legend.key.width = unit(1, "cm"), legend.text = element_text(size = 8))
pdf("path.pdf",width=7,height=5)
map <- mapPlot + geom_polygon(data=data, aes(x = long, y = lat, group = group, fill = data$var1), lwd = 1/10, color="lavenderblush4") +
scale_fill_continuous(name = "Average", low="white", high="dodgerblue4", guide="colorbar", limits=c(0.0,1.0), labels=c("6", "661", "1,106", "2,037", "11,846")) +
theme(legend.text = element_text(size=10))
map <- map + coord_map(project="conic", lat0 = 30)
plot(map)
This is producing a nice graduated colors map, but I'm unsure how to combine it with an additional layer (and thus additional legend).
I would like to something (relatively) straightforward such as asked here: How do I plot points as graduated/proportional circles in R?
EDIT: Information about my data
-Currently using commuter zone areal units
-Do not have centroids for these units (yet - would they help?)
EDIT 2: Found this link (https://datacarpentry.org/r-raster-vector-geospatial/08-vector-plot-shapefiles-custom-legend/), going to update my results
Edit 3: No luck via link.