Hi all,
I am studying the geographical distribution across the US of female registered apprentices. I would like to create a heat map, with colours getting darker as the fraction of registered apprentices who are female increases. My data are at the bottom of the post. This is the code I used to create the base map:
This is the code I ran to obtain the heat map:
And I obtained a very weird looking juxtaposition of planes:

I am studying the geographical distribution across the US of female registered apprentices. I would like to create a heat map, with colours getting darker as the fraction of registered apprentices who are female increases. My data are at the bottom of the post. This is the code I used to create the base map:
Code:
*downloaded from https://www.census.gov/geographies/mapping-files/time-series/geo/carto-boundary-file.html global geo "C:\Users\maxen\OneDrive\Desktop\PhD ETHZ\Dissertation\3rd Thesis Paper" spshape2dta "$geo/cb_2021_us_state_500k", replace saving(usa_state) use usa_state, clear use usa_state_shp, clear merge m:1 _ID using usa_state // to get the identifiers drop _merge bys _ID: keep if [_n]==_N save "$geo/usa_state_shp", replace
Code:
spmap fraction_female using usa_state_shp, id(_ID) clm(custom) clb(0(4)33.4) fcolor(Heat)
Code:
input byte _ID double(_X _Y) str2 STUSPS float fraction_female 1 49.02787128888888 -92.08864903414468 "WY" 12.534905 2 .6057272888888755 -85.39691352525129 "AK" 11.479944 3 71.47544894003143 -97.5811933302781 "MD" 5.350404 4 6.336089599999997 -135.90882478523687 "AS" 0 5 60.71614648888888 -100.0871682947566 "AR" 3.791729 6 54.009828694937596 -88.0635092613424 "ND" 3.5963066 7 74.1058450051695 -97.23149612350693 "DE" 1.8789144 8 230.83951502222223 -118.34808378241493 "GU" 20.253164 9 50.45321031111111 -104.39470203636344 "NM" 3.030672 10 46.89567146666667 -99.11300170409012 "UT" 3.777716 11 69.23150357072505 -98.59377201512844 "WV" 30.06316 12 55.42987093333333 -96.91340704183914 "KS" 7.014288 13 67.12521600000001 -101.41434469530365 "GA" 8.620851 14 62.82310471111111 -104.58474232187172 "MS" 13.690063 15 58.85211804444444 -87.94999434832852 "MN" 4.3460264 16 76.40373546666666 -94.20976098904711 "NH" 9.969101 17 59.89436515555555 -96.37722803660961 "MO" 9.910444 18 44.62743111111111 -92.69331628139834 "ID" 11.696406 19 54.003286044444444 -92.09201796278641 "SD" 7.949657 20 70.74141084444445 -96.06894698385321 "PA" 6.625429 21 54.753731555555554 -100.06312548284674 "OK" 3.419425 22 65.352704 -98.83308884149741 "IN" 8.745133 23 74.26908302222223 -97.25967829058163 "NJ" 6.856187 24 54.00645792350507 -95.82016655641485 "NE" 9.910556 25 50.44604231111111 -98.20346381611235 "CO" 8.889801 26 71.28024746666667 -94.798538114969 "NY" 10.020782 27 45.4761670022265 -88.45312691127808 "MT" 13.968958 28 64.3047047111111 -100.0401303056136 "KY" 8.533903 29 75.77760711111111 -93.04213907329684 "VT" 14.52514 30 73.15928248888889 -97.8979187299625 "DC" 2.955665 31 70.66681315555556 -109.48614454061408 "FL" 13.45012 32 42.66207797468658 -97.58769344334392 "NV" 8.214585 33 231.03069937777778 -113.06731694435379 "MP" 0 34 63.77923342222222 -101.39870436109314 "TN" 5.393526 35 59.27938918599851 -94.32365055815427 "IA" 3.5876575 36 65.08570524444445 -104.04885037688568 "AL" 5.043982 37 63.70265884444444 -90.49251856080303 "MI" 7.377975 38 39.5316615111111 -96.50350034939278 "CA" 2.845142 39 75.57136 -95.88611067824696 "CT" 3.7974684 40 46.35285759999999 -103.53270352326808 "AZ" 5.918295 41 52.163214933333336 -104.04481826371185 "TX" 3.979268 42 68.49805226666666 -99.99540028869471 "VA" 19.67362 43 62.92410737777778 -96.74796288668045 "IL" 3.694091 44 1.1853980444444343 -106.927211020208 "HI" 5.281467 45 39.420732444444454 -94.22153859615949 "OR" 4.3137255 46 76.89765849441095 -95.68746238552183 "RI" 6.463878 47 81.71707591111111 -114.73201703017544 "VI" 0 48 68.72610844444445 -101.66167718753307 "SC" 22.41447 49 39.27988764444444 -88.80060382967854 "WA" 16.857914 50 79.68377528888888 -114.92083362374068 "PR" 33.333332 51 61.124873244444444 -103.37655052640878 "LA" 11.48805 52 77.45422008888889 -91.7800524712069 "ME" 29.588015 53 67.68344248888889 -97.62961592054371 "OH" 5.933706 54 61.94623004444444 -91.4541702776673 "WI" 8.695652 55 68.04089543582201 -101.38207922367356 "NC" 3.430079 56 75.72754346666667 -94.94896627060787 "MA" 6.13563
Comment