Stata graphs: Bi-variate maps

Asjad Naqvi
The Stata Guide
Published in
17 min readDec 7, 2021

--

Note: This guide has been converted into the Stata bimap package that significantly improves the process described below. You can still follow this guide to understand how bi-variate maps are programmed.

In this guide, we will learn how to make the following bi-variate map of the USA in Stata:

Bi-variate graphs are complex. Not because they are difficult to make, but because they are a hit or a miss since we are plotting multiple dimensions, and hoping to see some sort of visual clustering. If you do manage to find a story, then the reward for your visualization is worth it. The map below is the first Stata bi-variate map I posted on Twitter as part of the #30DayMapChallenge and the response was overwhelmingly positive.

I also got a bunch of requests for replication code. So here it is!

In the guide, we will start with the above image. The first image is a bonus and the code is provided at the end of this guide.

So what all goes into making a bi-variate plot in Stata? Not so much! If you are familiar with making maps, then it is all about the correct color assignment. Colors have to be manually generated and we will discuss…

--

--

Asjad Naqvi
The Stata Guide

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