Hi
I am using Stata 15.0. I am creating maps using spmap and want to move the position of the legend but don't see anything on this in the helpfile. I downloaded the shape maps files for South Africa and then adjusted the file to only include the perimeters of the map that I am interested in saving this as "nalcoord" and "naldb" (see below).
The variable, temp, and the two coordinate variables are below (just for observations 1-8 for simplicity):
My code to create the map is below
My legend covers the map. How do I move the position of it - ideally to the top left corner?
Thanks
Megan
I am using Stata 15.0. I am creating maps using spmap and want to move the position of the legend but don't see anything on this in the helpfile. I downloaded the shape maps files for South Africa and then adjusted the file to only include the perimeters of the map that I am interested in saving this as "nalcoord" and "naldb" (see below).
The variable, temp, and the two coordinate variables are below (just for observations 1-8 for simplicity):
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float temp double(d14_longitude d14_latitude) 1 29.76778 -31.01171 2 29.76806 -31.0615 3 29.776561 -29.051018 6 30.2256401 -31.0056761 8 30.194423 -30.962085 16 29.89055 -31.0671 19 30.8276417 -30.0593772 25 29.132649 -28.688167 end
Code:
* Save the specific local municipalities I am interested in use "$maps/rsadb_lm.dta", clear keep if OBJECTID==15|OBJECTID==161|OBJECTID==162|OBJECTID==163|OBJECTID==40|OBJECTID==39|OBJECTID==38|OBJECTID==152|OBJECTID==168|OBJECTID==43|OBJECTID==42|OBJECTID==41|OBJECTID==55 save "$maps/naldb_lm.dta", replace list OBJECTID use "$maps/rsacoord_lm.dta", clear keep if _ID==15|(_ID>=38&_ID<=64)|(_ID>=152&_ID<=156)|(_ID>=161&_ID<=175)|(_ID>=206&_ID<=207) drop if _ID==164|_ID==165 save "$maps/nalcoord_lm.dta", replace *Create the map spmap using "$maps/nalcoord_lm.dta", id(_ID) line(data("$maps/nalcoord_lm.dta") size(vvthin)) /* */ point(data("$temp\temp1.dta") by(n) fcolor(Blues2) ocolor(none) size(vtiny) xcoord(d14_long) ycoord(d14_lat) legenda(on) legtitle(Number RCs)) /* */label(data("$maps/naldb_lm.dta") xcoord(x_c) ycoord(y_c) label(OBJECTID) size(medium)) title(Number of RCs)
Thanks
Megan
Comment