Stata graphs: Reprogramming maps

Asjad Naqvi
The Stata Guide
Published in
17 min readMar 30, 2021

--

In this guide we will learn how to reprogram maps in Stata:

Why is this guide necessary given the already amazing spmap package? To be honest, spmap is a great tool for making maps in Stata. It is fairly extensive with a lot of customization options. I also use it very frequently and have covered it in detail in my earlier guides on maps and animations. However, it has a couple of limitations. First, it does not allow multiple layers to be individually customized. One can technically add supplementary polygon, line, or point layers and use the by() option to draw various layers using different colors. But customizing several layers in one map is not currently possible especially, if we want to several choropleth (or heat) layers in one map. For example, think about different building types differentiated by zones. We can plot building area by zone type and color code both of them. And then on top of this, we can also add data on parks, streets, rivers etc. Since, none of these layers overlap with each other, they can be visualized on one map. Here we are thinking of going in the direction of doing what standard GIS softwares like ArcGIS or QGIS can do. Second, the spmap package currently cannot be combined with other twoway graph options. These options can be highly valuable to add annotations and additional information on the map. If you have followed my earlier guides, my whole aim is…

--

--

Asjad Naqvi
The Stata Guide

Here you will find stuff on Stata, data visualizations, data wrangling, workflows, and programming.