It is my first time using "spmap" command to produce maps.
I am working on a panel of a number of African countries and I would like to display the results on a map alongside the country name.
May someone kindly help how to plot the map with country names and labels displayed on it.
The following is my dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int ccode float pi_episodes str29 cname str3 ccodealp int(ccodecow ccodewb) str13 version int na_id_world str35 ADMIN str32 SOVEREIGNT long COWcode double country_id str32 country_name 9021 20 "" "" . . "" 19 "British Indian Ocean Territory" "United Kingdom" . . "" 9010 . "" "" . . "" 162 "Saint Pierre and Miquelon" "France" . . "" 9018 . "" "" . . "" 95 "Niue" "New Zealand" . . "" 9029 . "" "" . . "" 21 "Pitcairn Islands" "United Kingdom" . . "" 9024 . "" "" . . "" 23 "Falkland Islands" "United Kingdom" . . "" 9006 . "" "" . . "" 168 "French Southern and Antarctic Lands" "France" . . "" 9013 . "" "" . . "" 131 "Kosovo" "Kosovo" 347 43 "Kosovo" 9035 . "" "" . . "" 12 "Northern Mariana Islands" "United States of America" . . "" 9037 . "" "" . . "" 13 "United States Virgin Islands" "United States of America" . . "" 9023 . "" "" . . "" 24 "Cayman Islands" "United Kingdom" . . "" 9028 . "" "" . . "" 28 "Montserrat" "United Kingdom" . . "" 9012 . "" "" . . "" 239 "Siachen Glacier" "Kashmir" . . "" 9019 . "" "" . . "" 22 "Anguilla" "United Kingdom" . . "" 9007 . "" "" . . "" 167 "New Caledonia" "France" . . "" 9020 . "" "" . . "" 25 "Bermuda" "United Kingdom" . . "" 9027 . "" "" . . "" 29 "Jersey" "United Kingdom" . . "" 9030 . "" "" . . "" 20 "Saint Helena" "United Kingdom" . . "" 9025 . "" "" . . "" 30 "Guernsey" "United Kingdom" . . "" 9038 . "" "" . . "" 6 "Vatican" "Vatican" . . "" 9032 . "" "" . . "" 27 "Turks and Caicos Islands" "United Kingdom" . . "" 9039 . "" "" . . "" 105 "Western Sahara" "Western Sahara" . . "" 9016 . "" "" . . "" 240 "Sint Maarten" "Netherlands" . . "" 9015 . "" "" . . "" 99 "Cura�ao" "Netherlands" . . "" 9026 . "" "" . . "" 31 "Isle of Man" "United Kingdom" . . "" 9034 . "" "" . . "" 14 "Guam" "United States of America" . . "" 9003 . "" "" . . "" 182 "Greenland" "Denmark" . . "" 9014 . "" "" . . "" 98 "Aruba" "Netherlands" . . "" 9036 . "" "" . . "" 16 "Puerto Rico" "United States of America" . . "" 9011 . "" "" . . "" 163 "Wallis and Futuna" "France" . . "" 9005 . "" "" . . "" 166 "French Polynesia" "France" . . "" 9009 . "" "" . . "" 164 "Saint Martin" "France" . . "" 9008 . "" "" . . "" 165 "Saint Barthelemy" "France" . . "" 9017 . "" "" . . "" 96 "Cook Islands" "New Zealand" . . "" 9022 . "" "" . . "" 26 "British Virgin Islands" "United Kingdom" . . "" 9031 . "" "" . . "" 18 "South Georgia and the Islands" "United Kingdom" . . "" 9002 . "" "" . . "" 183 "Faroe Islands" "Denmark" . . "" 9033 . "" "" . . "" 15 "American Samoa" "United States of America" . . "" 4 . "Afghanistan" "AFG" 700 4 "QoGStdCSJan21" 238 "Afghanistan" "Afghanistan" 700 36 "Afghanistan" 8 . "Albania" "ALB" 339 8 "QoGStdCSJan21" 237 "Albania" "Albania" 339 12 "Albania" 12 10 "Algeria" "DZA" 615 12 "QoGStdCSJan21" 236 "Algeria" "Algeria" 615 103 "Algeria" 20 . "Andorra" "AND" 232 20 "QoGStdCSJan21" 235 "Andorra" "Andorra" 232 . "" 24 . "Angola" "AGO" 540 24 "QoGStdCSJan21" 234 "Angola" "Angola" 540 104 "Angola" 28 . "Antigua and Barbuda" "ATG" 58 28 "QoGStdCSJan21" 233 "Antigua and Barbuda" "Antigua and Barbuda" 58 . "" 32 . "Argentina" "ARG" 160 32 "QoGStdCSJan21" 232 "Argentina" "Argentina" 160 37 "Argentina" 51 . "Armenia" "ARM" 371 51 "QoGStdCSJan21" 231 "Armenia" "Armenia" 371 105 "Armenia" 36 . "Australia" "AUS" 900 36 "QoGStdCSJan21" 228 "Heard Island and McDonald Islands" "Australia" 900 67 "Australia" 36 . "Australia" "AUS" 900 36 "QoGStdCSJan21" 229 "Norfolk Island" "Australia" 900 67 "Australia" 36 . "Australia" "AUS" 900 36 "QoGStdCSJan21" 230 "Ashmore and Cartier Islands" "Australia" 900 67 "Australia" 36 . "Australia" "AUS" 900 36 "QoGStdCSJan21" 227 "Indian Ocean Territories" "Australia" 900 67 "Australia" 36 . "Australia" "AUS" 900 36 "QoGStdCSJan21" 226 "Australia" "Australia" 900 67 "Australia" 40 . "Austria" "AUT" 305 40 "QoGStdCSJan21" 225 "Austria" "Austria" 305 144 "Austria" 31 . "Azerbaijan" "AZE" 373 31 "QoGStdCSJan21" 224 "Azerbaijan" "Azerbaijan" 373 106 "Azerbaijan" 44 . "Bahamas" "BHS" 31 44 "QoGStdCSJan21" 223 "The Bahamas" "The Bahamas" 31 . "" 48 . "Bahrain" "BHR" 692 48 "QoGStdCSJan21" 222 "Bahrain" "Bahrain" 692 146 "Bahrain" 50 . "Bangladesh" "BGD" 771 50 "QoGStdCSJan21" 221 "Bangladesh" "Bangladesh" 771 24 "Bangladesh" 52 . "Barbados" "BRB" 53 52 "QoGStdCSJan21" 220 "Barbados" "Barbados" 53 147 "Barbados" 112 . "Belarus" "BLR" 370 112 "QoGStdCSJan21" 219 "Belarus" "Belarus" 370 107 "Belarus" 56 . "Belgium" "BEL" 211 56 "QoGStdCSJan21" 218 "Belgium" "Belgium" 211 148 "Belgium" 84 . "Belize" "BLZ" 80 84 "QoGStdCSJan21" 217 "Belize" "Belize" 80 . "" 204 . "Benin" "BEN" 434 204 "QoGStdCSJan21" 216 "Benin" "Benin" 434 52 "Benin" 64 . "Bhutan" "BTN" 760 64 "QoGStdCSJan21" 215 "Bhutan" "Bhutan" 760 53 "Bhutan" 68 . "Bolivia" "BOL" 145 68 "QoGStdCSJan21" 214 "Bolivia" "Bolivia" 145 25 "Bolivia" 70 . "Bosnia and Herzegovina" "BIH" 346 70 "QoGStdCSJan21" 213 "Bosnia and Herzegovina" "Bosnia and Herzegovina" 346 150 "Bosnia and Herzegovina" 72 . "Botswana" "BWA" 571 72 "QoGStdCSJan21" 212 "Botswana" "Botswana" 571 68 "Botswana" 76 . "Brazil" "BRA" 140 76 "QoGStdCSJan21" 211 "Brazil" "Brazil" 140 19 "Brazil" 96 . "Brunei" "BRN" 835 96 "QoGStdCSJan21" 210 "Brunei" "Brunei" 835 . "" 100 . "Bulgaria" "BGR" 355 100 "QoGStdCSJan21" 209 "Bulgaria" "Bulgaria" 355 152 "Bulgaria" 854 1 "Burkina Faso" "BFA" 439 854 "QoGStdCSJan21" 208 "Burkina Faso" "Burkina Faso" 439 54 "Burkina Faso" 108 29 "Burundi" "BDI" 516 108 "QoGStdCSJan21" 207 "Burundi" "Burundi" 516 69 "Burundi" 116 . "Cambodia" "KHM" 811 116 "QoGStdCSJan21" 205 "Cambodia" "Cambodia" 811 55 "Cambodia" 120 . "Cameroon" "CMR" 471 120 "QoGStdCSJan21" 204 "Cameroon" "Cameroon" 471 108 "Cameroon" 124 . "Canada" "CAN" 20 124 "QoGStdCSJan21" 203 "Canada" "Canada" 20 66 "Canada" 132 . "Cape Verde" "CPV" 402 132 "QoGStdCSJan21" 202 "Cabo Verde" "Cabo Verde" 402 70 "Cape Verde" 140 4 "Central African Republic" "CAF" 482 140 "QoGStdCSJan21" 201 "Central African Republic" "Central African Republic" 482 71 "Central African Republic" 148 . "Chad" "TCD" 483 148 "QoGStdCSJan21" 200 "Chad" "Chad" 483 109 "Chad" 152 . "Chile" "CHL" 155 152 "QoGStdCSJan21" 199 "Chile" "Chile" 155 72 "Chile" 156 . "China" "CHN" 710 156 "QoGStdCSJan21" 197 "Macao S.A.R" "China" 710 110 "China" 156 . "China" "CHN" 710 156 "QoGStdCSJan21" 196 "China" "China" 710 110 "China" 156 . "China" "CHN" 710 156 "QoGStdCSJan21" 198 "Hong Kong S.A.R." "China" . 167 "Hong Kong" 170 . "Colombia" "COL" 100 170 "QoGStdCSJan21" 195 "Colombia" "Colombia" 100 15 "Colombia" 174 4 "Comoros" "COM" 581 174 "QoGStdCSJan21" 194 "Comoros" "Comoros" 581 153 "Comoros" 178 4 "Congo" "COG" 484 178 "QoGStdCSJan21" 193 "Republic of the Congo" "Republic of the Congo" 484 112 "Republic of the Congo" 180 20 "Congo, Democratic Republic" "COD" 490 180 "QoGStdCSJan21" 192 "Democratic Republic of the Congo" "Democratic Republic of the Congo" 490 111 "Democratic Republic of the Congo" 188 . "Costa Rica" "CRI" 94 188 "QoGStdCSJan21" 191 "Costa Rica" "Costa Rica" 94 73 "Costa Rica" 384 6 "Cote d'Ivoire" "CIV" 437 384 "QoGStdCSJan21" 190 "Ivory Coast" "Ivory Coast" 437 64 "Ivory Coast" 191 . "Croatia" "HRV" 344 191 "QoGStdCSJan21" 189 "Croatia" "Croatia" 344 154 "Croatia" 192 . "Cuba" "CUB" 40 192 "QoGStdCSJan21" 188 "Cuba" "Cuba" 40 155 "Cuba" 196 . "Cyprus (1975-)" "CYP" 352 196 "QoGStdCSJan21" 186 "Northern Cyprus" "Northern Cyprus" 352 156 "Cyprus" 196 . "Cyprus (1975-)" "CYP" 352 196 "QoGStdCSJan21" 187 "Cyprus" "Cyprus" 352 156 "Cyprus" 203 . "Czech Republic" "CZE" 316 203 "QoGStdCSJan21" 185 "Czechia" "Czechia" 316 157 "Czech Republic" 208 . "Denmark" "DNK" 390 208 "QoGStdCSJan21" 184 "Denmark" "Denmark" 390 158 "Denmark" 262 . "Djibouti" "DJI" 522 262 "QoGStdCSJan21" 181 "Djibouti" "Djibouti" 522 113 "Djibouti" 212 . "Dominica" "DMA" 54 212 "QoGStdCSJan21" 180 "Dominica" "Dominica" 54 . "" 214 . "Dominican Republic" "DOM" 42 214 "QoGStdCSJan21" 179 "Dominican Republic" "Dominican Republic" 42 114 "Dominican Republic" 218 . "Ecuador" "ECU" 130 218 "QoGStdCSJan21" 178 "Ecuador" "Ecuador" 130 75 "Ecuador" 818 10 "Egypt" "EGY" 651 818 "QoGStdCSJan21" 177 "Egypt" "Egypt" 651 13 "Egypt" 222 . "El Salvador" "SLV" 92 222 "QoGStdCSJan21" 176 "El Salvador" "El Salvador" 92 22 "El Salvador" 226 . "Equatorial Guinea" "GNQ" 411 226 "QoGStdCSJan21" 175 "Equatorial Guinea" "Equatorial Guinea" 411 160 "Equatorial Guinea" 232 . "Eritrea" "ERI" 531 232 "QoGStdCSJan21" 174 "Eritrea" "Eritrea" 531 115 "Eritrea" 233 . "Estonia" "EST" 366 233 "QoGStdCSJan21" 173 "Estonia" "Estonia" 366 161 "Estonia" end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int _ID double(_X _Y) 1 . . 1 3482952.052927235 -2543587.676422582 1 3472863.724074095 -2536749.8178385445 1 3459079.2396966117 -2532309.6497684247 1 3441565.9876367627 -2530265.237711122 1 3418802.021174761 -2531118.0182870994 1 3390809.0832335497 -2534845.0732263266 1 3360783.259920928 -2530311.963717328 1 3328713.6797754266 -2517525.4776802277 1 3302079.622197913 -2512997.1042622314 1 3270281.8185704285 -2518552.7030778257 1 3268879.4534740415 -2518692.783595965 1 3263356.963667067 -2514362.4886644464 1 3254670.9987971187 -2505017.0974370185 1 3240158.155444154 -2503372.5709682554 1 3236222.8377862065 -2501191.7819124926 1 3232983.2658325215 -2497717.102596074 1 3230863.41210893 -2493287.3494535554 1 3230026.3418583255 -2488357.71335698 1 3232417.9720999342 -2473018.6689636186 1 3231113.446817201 -2471295.7912127115 1 3227232.4842402176 -2469456.6971572423 1 3219285.750920416 -2467617.8044758416 1 3200185.3267115396 -2460659.7506609987 1 3176171.190047769 -2453948.7499165423 1 3137165.8846506295 -2446577.846469213 1 3122022.519909448 -2444636.830598079 1 3118511.1725509404 -2442393.8949080394 1 3114119.2713223347 -2436747.1866317573 1 3106639.9930346613 -2419191.5493404097 1 3099595.5565078994 -2407602.1137192375 1 3082821.5348850023 -2389740.127698174 1 3080147.2577770995 -2384191.6975185727 1 3080984.3291408992 -2370033.2424617633 1 3082223.6278811973 -2358603.685910595 1 3084028.221467278 -2348903.6407070095 1 3083212.89302642 -2339832.7301451257 1 3082973.72977962 -2328572.766314056 1 3083506.411354184 -2321023.915929738 1 3081245.2341974457 -2317758.3532636147 1 3075157.4495446887 -2315462.4316519997 1 3057829.00453748 -2314424.171909108 1 3036880.50312303 -2314885.6133852922 1 3036195.627767043 -2303445.3659195765 1 3034206.2260151273 -2285768.795196562 1 3030281.7798186503 -2275601.641789737 1 3025465.907177409 -2270318.8090760293 1 3015845.033356398 -2264807.4197330214 1 2996353.251006104 -2257262.1573933475 1 2969806.1617807723 -2245800.6798412 1 2947140.035132424 -2228845.710900142 1 2921136.4978299327 -2207776.9844873324 1 2913015.8278057664 -2204130.2411171463 1 2903427.5661427774 -2184372.167020248 1 2888816.8829761604 -2150599.72798647 1 2889762.664501889 -2139351.694877324 1 2887555.842426115 -2133855.8110383893 1 2873369.1295589386 -2117297.621962341 1 2870227.398532102 -2108704.3506666757 1 2867727.0581285637 -2100023.6244518664 1 2845137.0283709266 -2075815.4447118298 1 2837451.200107672 -2065259.2979341391 1 2831602.578701714 -2051705.0828401113 1 2825775.6991055035 -2040877.4135590817 1 2820861.9877638044 -2036511.6008889861 1 2814426.3297023186 -2029146.4345867704 1 2809958.330469806 -2020750.234127523 1 2807925.4450983964 -2014492.2689725598 1 2809599.585599606 -2006102.1164875813 1 2811795.5362139093 -2000347.9415283427 1 2833276.7192029236 -2006340.4898533307 1 2845006.576399251 -2006851.2994509474 1 2854192.6084593507 -2003900.1298252922 1 2865541.9778625364 -2007861.6056509365 1 2879087.29899322 -2018762.4686661873 1 2893850.177054455 -2020841.1080761258 1 2909841.482394517 -2014083.466484202 1 2931420.5051971846 -2016127.5586956681 1 2958598.114697539 -2026976.0404625435 1 2981122.9179127403 -2029180.5265382198 1 3007941.783656089 -2019512.1172390808 1 3031868.9519676776 -1992768.9683956043 1 3054372.013373132 -1967646.6730737456 1 3076505.458446916 -1938684.8314474318 1 3089844.2296020174 -1915322.4483324518 1 3109401.2373815514 -1896332.5183262199 1 3135176.482898714 -1881714.5668898681 1 3161451.7967192223 -1869361.895569513 1 3201620.3039659485 -1854254.8798868547 1 3201609.433617673 -1854277.4207901768 1 3209643.1341764624 -1841816.2940354303 1 3212317.4112843648 -1828213.9554828468 1 3212317.4112843648 -1809333.0605903023 1 3214415.5231982097 -1797110.56279916 1 3218590.004102957 -1791546.8466177532 1 3225264.8254112434 -1787209.216897922 1 3233896.434087033 -1781580.5188574556 1 3260313.0713406885 -1767239.7744009965 1 3282511.742956908 -1758080.751828088 1 3309482.8024816792 -1752088.9434187524 end
I can only get the map without the labels and country names using the following command:
spmap pi_episodes using "coord_mercator_afr.dta", id(na_id_world) fcolor(BuRd) ocolor(green ..)
Array
0 Response to spmap: displaying country name and labels (values) when using spmap command
Post a Comment