Hi everyone - this is my first ever post on this forum.
I've been having a problem using the spmap command. I'm plotting proportions of antibiotic-resistant isolates by region. I also have the data split up by community and hospital isolates. In order to compare the proportion resistant from community isolates with hospital isolates within a particular region I created artificial circular "regions" to represent the hospitals - it seems to me this was the only way to do it since there isn't an option in spmap to insert points/markers on a map and have them display the data using the same (color) scale for both the community and hospital isolates. The problem is that some of these circles become either completely or partially hidden under the base map.
Here is the code I used:
Here are the data:
I've attached the corresponding coordinates .dta file. coordinates_XY.dta
Any help much appreciated.
Will
I've been having a problem using the spmap command. I'm plotting proportions of antibiotic-resistant isolates by region. I also have the data split up by community and hospital isolates. In order to compare the proportion resistant from community isolates with hospital isolates within a particular region I created artificial circular "regions" to represent the hospitals - it seems to me this was the only way to do it since there isn't an option in spmap to insert points/markers on a map and have them display the data using the same (color) scale for both the community and hospital isolates. The problem is that some of these circles become either completely or partially hidden under the base map.
Here is the code I used:
Code:
levelsof abx_class, local(abx) *E. coli foreach a of local abx { #delimit ; spmap percent_resistant if organism == "E.coli" & abx_class == "`a'" using coordinates_XY.dta, id(_ID) title("`a'", size(small)) clbreaks(0(10)100) clmethod(custom) fcolor(Reds2) ndfcolor(white) ndlab("no isolates") legtitle("% resistant") legstyle(2) graphregion(color(white) margin(b=0 t=0)) plotregion(margin(b=0 t=0)) bgcolor(white) name("`a'", replace) ; #delimit cr } grc1leg ESBLs Fluoroquinolones Gentamicin SXT, col(2) graphregion(color(white) margin(b=0 t=0)) title("{it:E. coli}", size(medsmall)) position(9) name(Ecoli, replace)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str3 jurisdiction str36 region str48 organism str33 abx_class double(num_of_tests resistant susceptible) float percent_resistant long _ID "FNQ" "Mackay" "E.coli" "ESBLs" . . . . 1 "FNQ" "Mackay" "E.coli" "Fluoroquinolones" . . . . 1 "FNQ" "Mackay" "E.coli" "Gentamicin" . . . . 1 "FNQ" "Mackay" "E.coli" "SXT" . . . . 1 "FNQ" "Townsville" "E.coli" "SXT" . . . . 2 "FNQ" "Townsville" "E.coli" "Gentamicin" . . . . 2 "FNQ" "Townsville" "E.coli" "ESBLs" . . . . 2 "FNQ" "Townsville" "E.coli" "Fluoroquinolones" . . . . 2 "FNQ" "North West" "E.coli" "SXT" . . . . 3 "FNQ" "North West" "E.coli" "Gentamicin" . . . . 3 "FNQ" "North West" "E.coli" "ESBLs" . . . . 3 "FNQ" "North West" "E.coli" "Fluoroquinolones" . . . . 3 "FNQ" "Cairns and Hinterland" "E.coli" "SXT" . . . . 4 "FNQ" "Cairns and Hinterland" "E.coli" "Gentamicin" 15 0 15 0 4 "FNQ" "Cairns and Hinterland" "E.coli" "ESBLs" 10 0 10 0 4 "FNQ" "Cairns and Hinterland" "E.coli" "Fluoroquinolones" 10 0 10 0 4 "FNQ" "Torres and Cape" "E.coli" "Fluoroquinolones" . . . . 5 "FNQ" "Torres and Cape" "E.coli" "Gentamicin" . . . . 5 "FNQ" "Torres and Cape" "E.coli" "ESBLs" . . . . 5 "FNQ" "Torres and Cape" "E.coli" "SXT" . . . . 5 "WA" "Kimberley" "E.coli" "Fluoroquinolones" 55 7 48 12.727273 304 "WA" "Kimberley" "E.coli" "SXT" 9 5 4 55.55556 304 "WA" "Kimberley" "E.coli" "Gentamicin" 13 3 10 23.076923 304 "WA" "Kimberley" "E.coli" "ESBLs" 9 5 4 55.55556 304 "NT" "Alice Springs" "E.coli" "Fluoroquinolones" 523 67 456 12.810707 334 "NT" "Alice Springs" "E.coli" "SXT" 123 61 62 49.59349 334 "NT" "Alice Springs" "E.coli" "ESBLs" 123 40 83 32.520325 334 "NT" "Alice Springs" "E.coli" "Gentamicin" 506 61 445 12.055336 334 "NT" "Barkly" "E.coli" "Fluoroquinolones" 745 92 653 12.348993 335 "NT" "Barkly" "E.coli" "SXT" 212 106 106 50 335 "NT" "Barkly" "E.coli" "Gentamicin" 724 106 618 14.640884 335 "NT" "Barkly" "E.coli" "ESBLs" 213 56 157 26.29108 335 "NT" "East Arnhem" "E.coli" "Fluoroquinolones" 206 12 194 5.825243 337 "NT" "East Arnhem" "E.coli" "SXT" 36 24 12 66.666664 337 "NT" "East Arnhem" "E.coli" "ESBLs" 36 11 25 30.555555 337 "NT" "East Arnhem" "E.coli" "Gentamicin" 197 27 170 13.705584 337 "NT" "Katherine" "E.coli" "Gentamicin" 1375 94 1281 6.836364 338 "NT" "Katherine" "E.coli" "SXT" 315 162 153 51.42857 338 "NT" "Katherine" "E.coli" "Fluoroquinolones" 1429 88 1341 6.158153 338 "NT" "Katherine" "E.coli" "ESBLs" 316 61 255 19.303797 338 "WA" "Pilbara" "E.coli" "Gentamicin" 47 3 44 6.382979 99999 "WA" "Pilbara" "E.coli" "ESBLs" 44 12 32 27.27273 99999 "WA" "Pilbara" "E.coli" "SXT" 44 21 23 47.72727 99999 "WA" "Pilbara" "E.coli" "Fluoroquinolones" 281 21 260 7.47331 99999 "NT" "Darwin" "E.coli" "SXT" 323 155 168 47.98762 999999 "NT" "Darwin" "E.coli" "Fluoroquinolones" 1856 147 1709 7.920259 999999 "NT" "Darwin" "E.coli" "ESBLs" 323 105 218 32.50774 999999 "NT" "Darwin" "E.coli" "Gentamicin" 1719 110 1609 6.399069 999999 "NT" "Darwin_hospital" "E.coli" "Gentamicin" 1172 109 1063 9.300342 9000000 "NT" "Darwin_hospital" "E.coli" "SXT" 1169 393 776 33.618477 9000000 "NT" "Darwin_hospital" "E.coli" "ESBLs" 1172 118 1054 10.06826 9000000 "NT" "Darwin_hospital" "E.coli" "Fluoroquinolones" 1172 130 1042 11.09215 9000000 "NT" "Gove_hospital" "E.coli" "Gentamicin" 127 20 107 15.748032 9000001 "NT" "Gove_hospital" "E.coli" "Fluoroquinolones" 127 10 117 7.874016 9000001 "NT" "Gove_hospital" "E.coli" "SXT" 127 48 79 37.795277 9000001 "NT" "Gove_hospital" "E.coli" "ESBLs" 127 10 117 7.874016 9000001 "NT" "Tennant_hospital" "E.coli" "ESBLs" 131 9 122 6.870229 9000002 "NT" "Tennant_hospital" "E.coli" "SXT" 130 53 77 40.76923 9000002 "NT" "Tennant_hospital" "E.coli" "Gentamicin" 131 18 113 13.740458 9000002 "NT" "Tennant_hospital" "E.coli" "Fluoroquinolones" 131 18 113 13.740458 9000002 "NT" "Katherine_hospital" "E.coli" "SXT" 37 13 24 35.135136 9000003 "NT" "Katherine_hospital" "E.coli" "Fluoroquinolones" 37 1 36 2.702703 9000003 "NT" "Katherine_hospital" "E.coli" "ESBLs" 37 2 35 5.405406 9000003 "NT" "Katherine_hospital" "E.coli" "Gentamicin" 37 3 34 8.1081085 9000003 "NT" "Alice_hospital" "E.coli" "Fluoroquinolones" 67 14 53 20.895523 9000004 "NT" "Alice_hospital" "E.coli" "Gentamicin" 67 11 56 16.41791 9000004 "NT" "Alice_hospital" "E.coli" "SXT" 67 33 34 49.25373 9000004 "NT" "Alice_hospital" "E.coli" "ESBLs" 67 8 59 11.940298 9000004 "FNQ" "Cairns_hospital" "E.coli" "Fluoroquinolones" 1721 125 1596 7.263219 9000007 "FNQ" "Cairns_hospital" "E.coli" "Gentamicin" 2082 93 1989 4.466859 9000007 "FNQ" "Cairns_hospital" "E.coli" "ESBLs" 1720 35 1685 2.0348837 9000007 end
Any help much appreciated.
Will
Comment