A Dot Map in Stata

A dot map is where the values of a variable are represented as a range of coloured dots separated by two categorical variables on the x and y axes.

To create a dot map in Stata you first need to download the zmap command from the SSC, which you do from within Stata with the following command:

ssc install zmap

To generate this graph in Stata, use the following commands:

sysuse nlsw88, clear
generate ln_wage = ln(wage)
egen mean = mean(ln_wage), by(age grade)
egen tag = tag(age grade)
label variable mean "Mean of ln(wage)"
summarize ln_wage if !missing(age, grade), detail
zmap mean grade age if tag & !missing(age, grade), breaks(`r(p5)' `r(p10)' `r(p25)' `r(p50)' `r(p75)' `r(p90)' `r(p95)') ms(S ..) yscale(on) xscale(on) ylabel(0/18, angle(horizontal)) xlabel(32(2)46) mcolor(blue blue\*0.7 blue\*0.3 lavender\*0.2 orange\*0.3 orange\*0.7 orange dkorange) legend(order(1 "0-5" 2 "5-10" 3 "10-25" 4 "25-50" 5 "50-75" 6 "75-90" 7 "90-95" 8 "95+")) note("") ytitle(`: variable label grade')