Scotland voted on 18 September 2014 in a referendum on the question Should Scotland be an independent country?
Apart from the genuine interest in this question (which many Stata users raised at the recent meetings in Boston and London), the dataset created provides a sandbox for those interested in statistical graphics. Results were reported by councils, that is local authority areas.
I used http://www.bbc.co.uk/news/events/sco...cides/results: this website provides a stacked or divided bar chart and a useful interactive map.
What else can we do? Here are the results of a morning's play (local time, naturally) together with the data and a script. For once, no user-written programs were used.
The simplest useful display of the main results I suggest to be a dot chart as reproducible using graph dot.

Small points to note here are changing the size to accommodate the number of points displayed. I find that the default grid of dotted lines in graph dot doesn't always export well to other software, so I tend to change that to very thin, light grey lines. Blue and red were the colours used by the different campaigns and in any case work well together in graphics.
In many ways the results cry out for a map and the BBC did a good one and no doubt many others will follow. But the standard choropleth (patch) map based on physical space often works badly when, as is very true of Scotland, the range of areas is great (here, 400x variation from smallest to largest). In any case, the precise detail of council area or coast outlines is not really important to understanding, for all that it may be familiar or interesting otherwise. An old and in many ways standard alternative is some kind of cartogram (http://en.wikipedia.org/wiki/Cartogram) in which area is replaced by some other measure (here most obviously electorate), with more or less faithfulness to contiguity or shape.
A recent map of the USA in the Economist for September 13 2014 -- article "Gunshot detectors: Calling the shots" -- provoked a much simpler alternative. It is also much cruder, but there you go. The idea is essentially to provide a chessboard approximation to the geography as basis for a map cartoon. (Cartoonography? I am not sure that will fly.) The only rule I followed strictly was to respect separation by sea. US readers (especially Stata friends who underline to me that they dropped geography at age 12 because it clashed with AP Calculus) should think of Alaska and Hawaii. Otherwise what was done was a rough compromise with some respect for each of contiguity, position and compass orientation.
This allows something to be done with graph twoway:

Scotland, so far as I know, lacks a standardized two-letter abbreviation for local authorities similar to that used in the USA, so I grew my own. (DG is already widely used in its own area, and that may be true elsewhere.) The result is, as said, crude, but it allows you to think about the spatial patterns in the data. You just have to think up some integers for the area coordinates, which for a country with 32 areas is a few minutes' work.
Here is a variation on the same theme, a kind of graphical table:

Here's all the code, for anyone interested at any level:
Apart from the genuine interest in this question (which many Stata users raised at the recent meetings in Boston and London), the dataset created provides a sandbox for those interested in statistical graphics. Results were reported by councils, that is local authority areas.
I used http://www.bbc.co.uk/news/events/sco...cides/results: this website provides a stacked or divided bar chart and a useful interactive map.
What else can we do? Here are the results of a morning's play (local time, naturally) together with the data and a script. For once, no user-written programs were used.
The simplest useful display of the main results I suggest to be a dot chart as reproducible using graph dot.
Small points to note here are changing the size to accommodate the number of points displayed. I find that the default grid of dotted lines in graph dot doesn't always export well to other software, so I tend to change that to very thin, light grey lines. Blue and red were the colours used by the different campaigns and in any case work well together in graphics.
In many ways the results cry out for a map and the BBC did a good one and no doubt many others will follow. But the standard choropleth (patch) map based on physical space often works badly when, as is very true of Scotland, the range of areas is great (here, 400x variation from smallest to largest). In any case, the precise detail of council area or coast outlines is not really important to understanding, for all that it may be familiar or interesting otherwise. An old and in many ways standard alternative is some kind of cartogram (http://en.wikipedia.org/wiki/Cartogram) in which area is replaced by some other measure (here most obviously electorate), with more or less faithfulness to contiguity or shape.
A recent map of the USA in the Economist for September 13 2014 -- article "Gunshot detectors: Calling the shots" -- provoked a much simpler alternative. It is also much cruder, but there you go. The idea is essentially to provide a chessboard approximation to the geography as basis for a map cartoon. (Cartoonography? I am not sure that will fly.) The only rule I followed strictly was to respect separation by sea. US readers (especially Stata friends who underline to me that they dropped geography at age 12 because it clashed with AP Calculus) should think of Alaska and Hawaii. Otherwise what was done was a rough compromise with some respect for each of contiguity, position and compass orientation.
This allows something to be done with graph twoway:
Scotland, so far as I know, lacks a standardized two-letter abbreviation for local authorities similar to that used in the USA, so I grew my own. (DG is already widely used in its own area, and that may be true elsewhere.) The result is, as said, crude, but it allows you to think about the spatial patterns in the data. You just have to think up some integers for the area coordinates, which for a country with 32 areas is a few minutes' work.
Here is a variation on the same theme, a kind of graphical table:
Here's all the code, for anyone interested at any level:
Code:
clear input str25 council str2 ab long electorate yes no area y x "Aberdeen City" "Ab" 175745 41.39 58.61 186 7 7 "Aberdeenshire" "As" 206486 39.64 60.36 6313 7 6 "Angus" "An" 93551 43.68 56.32 2182 6 6 "Argyll & Bute" "AB" 72002 41.48 58.52 6909 5 4 "Clackmannanshire" "Cl" 39972 46.20 53.80 159 5 6 "Comhairle nan Eilean Siar" "ES" 22908 46.58 53.42 3071 7 2 "Dumfries & Galloway" "DG" 122036 34.33 65.67 6426 1 3 "Dundee City" "Du" 118729 57.35 42.65 60 6 7 "East Ayrshire" "EA" 99664 47.22 52.78 1262 2 2 "East Dunbartonshire" "ED" 86836 38.80 61.20 175 4 4 "East Lothian" "EL" 81945 38.28 61.72 679 2 6 "East Renfrewshire" "ER" 72981 36.81 63.19 174 3 2 "Edinburgh" "Ed" 378012 38.90 61.10 264 3 6 "Falkirk" "Fa" 122457 46.53 53.47 297 4 5 "Fife" "Fi" 302165 44.95 55.05 1325 5 7 "Glasgow" "Gl" 486219 53.49 46.51 175 3 3 "Highland" "Hi" 190778 47.08 52.92 25659 7 4 "Inverclyde" "In" 62481 49.92 50.08 160 4 1 "Midlothian" "ML" 69617 43.70 56.30 354 2 5 "Moray" "Mo" 75170 42.44 57.56 2238 7 5 "North Ayrshire" "NA" 113923 48.99 51.01 885 3 1 "North Lanarkshire" "NL" 268704 51.07 48.93 470 3 4 "Orkney Islands" "Or" 17806 32.80 67.20 990 9 6 "Perth & Kinross" "PK" 120015 39.81 60.19 5286 6 5 "Renfrewshire" "Re" 134735 47.19 52.81 261 4 2 "Scottish Borders" "SB" 95533 33.44 66.56 4732 1 5 "Shetland Islands" "Sh" 18516 36.29 63.71 1466 11 6 "South Ayrshire" "SA" 94881 42.13 57.87 1222 2 1 "South Lanarkshire" "SL" 261157 45.33 54.67 1772 2 3 "Stirling" "St" 69033 40.23 59.77 2187 5 5 "West Dunbartonshire" "WD" 71109 53.96 46.04 159 4 3 "West Lothian" "WL" 138226 44.82 55.18 427 3 5 end notes : results from http://www.bbc.co.uk/news/events/scotland-decides/results 19 Sept 2014 notes : areas from http://en.wikipedia.org/wiki/List_of_Scottish_council_areas_by_area 19 Sept 2014 label var area "area (sq. km)" set scheme s1color separate yes, by(yes < 50) veryshortlabel graph dot (asis) yes0 yes1, over(council, sort(yes) descending) ysize(7) linetype(line) lines(lc(gs12) lw(vthin)) exclude0 ytitle(% voting Yes) ysc(alt) marker(1, mcolor(red)) marker(1, mcolor(blue)) legend(off) yli(50, lw(vvthin) lc(gs12)) graph export scotref1.png, replace more gen yes2 = 5 * floor(yes/5) separate y , by(yes2) veryshortlabel scatter y30-y55 x, ms(S ..) msize(*5 ..) mlcolor(gs12 ..) mcolor(red red*0.7 red*0.4 red*0.1 blue*0.1 blue*0.4) aspect(1.35) yscale(off) xscale(off) plotregion(lc(none)) || scatter y x, ms(none) mla(ab) mlabpos(0) mlabcolor(black) legend(col(1) order(1 "30-" 2 "35-" 3 "40-" 4 "45-" 5 "50-" 6 "55-") pos(3)) graph export scotref2.png, replace more gen yes3 = floor(yes) scatter y y x, ms(none ..) mla(ab yes3) mlabpos(12 0) mlabsize(*.9 *.9) aspect(1.35) yscale(off) xscale(off) plotregion(lc(none)) legend(off) graph export scotref3.png, replace
Comment