If you are familiar with the heatmaps with Stata, you might have encountered an annoying problem. When you want to make the legend, the title is the name of the variable. This not something that you necessarily want. The objective of this blog is to reproduce the picture below and remove the name of the variable on the legend.

*ssc install labmask
labmask imfcode, values(ISO3)
set scheme Cleanplots
graph set window fontface "Palatino Linotype"
gen GROWTH = 100*growth
format GROWTH %4.2f
*ssc install heatplot
heatplot GROWTH ISO3 period ///
if pop >= 2 & (eap==1 | sa==1), ///
cuts(-20(5)20) ///
color(plasma) ///
ti("Economic growth (Real GDP in USD) as percentage") ///
xti("") yti("") ///
ylabel(, angle(horizontal)) ///
xlabel(, angle(vertical)) ///
ramp(format(%4.0f) label(-20(5)20) subtitle("")) ///
name(GROWTH, replace)
graph export GROWTH.png, as(png) width(3000) replace
You have to use the subtitle(“”) option in the ramp. The ramp option controls the legend in the heatplot command.
1 Comment
[…] ←Previous post:Removing Headers in Heatmap Legend with Stata […]