Skip to content

Instantly share code, notes, and snippets.

@jamestrimble
Last active January 2, 2016 10:59
Show Gist options
  • Save jamestrimble/8293755 to your computer and use it in GitHub Desktop.
Save jamestrimble/8293755 to your computer and use it in GitHub Desktop.
A not-very-successful attempt at visualising the whisky data from https://www.mathstat.strath.ac.uk/outreach/nessie/nessie_whisky.html
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body {
background: #ccddee;
}
path {
stroke: #777;
fill: #fff;
}
circle.points {
fill: rgba(120,60,0,0.1);
stroke: rgba(120,60,0,0.7);
}
text {
fill: #444;
font-family: sans-serif;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script>
d3.select(self.frameElement)
.style("height", "1000px")
.style("width", "1600px");
var width = 1960,
height = 1200;
var projection = d3.geo.albers()
.center([0, 55.4])
.rotate([4.4, 0])
.parallels([50, 60])
.scale(900 * 5)
.translate([width / 2, height / 2]);
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("country-topo.json", function(error, scotland) {
d3.csv("whisky-data.csv", function(whisky) {
var dimensions = ["Body", "Sweetness", "Smoky", "Medicinal", "Tobacco", "Honey",
"Spicy", "Winey", "Nutty", "Malty", "Fruity", "Floral"]
for (var i=0; i<dimensions.length; i++) {
var dimension_g = svg.append("g")
.attr("transform", "translate(" + ((i%6)*300-800) + "," + (Math.floor(i/6)*450-130) + ")");
dimension_g.append("path")
.datum(topojson.feature(scotland, scotland.objects.layer1))
.attr("d", path);
dimension_g.selectAll("circles.points")
.data(whisky)
.enter()
.append("circle")
.attr("class", "points")
.attr("r",function(d) {return +d[dimensions[i]]*2 + 0.5})
.attr("transform", function(d) {return "translate(" + projection([d.Latitude,d.Longitude]) + ")";});
dimension_g
.append("text")
.text(dimensions[i])
.attr("transform", "translate(975,620)");
}
});
});
</script>
RowID Distillery Body Sweetness Smoky Medicinal Tobacco Honey Spicy Winey Nutty Malty Fruity Floral Postcode Latitude Longitude
1 Aberfeldy 2 2 2 0 0 2 1 2 2 2 2 2 PH15 2EB -3.85019901290135 56.6251911499812
2 Aberlour 3 3 1 0 0 4 3 2 2 3 3 2 AB38 9PJ -3.22964387692912 57.4673947305931
3 AnCnoc 1 3 2 0 0 2 0 0 2 2 3 2 AB5 5LI -2.78529460523676 57.4417508436895
4 Ardbeg 4 1 4 4 0 0 2 0 1 2 1 0 PA42 7EB -6.1085028918706 55.6406069251726
5 Ardmore 2 2 2 0 0 1 1 1 2 3 1 1 AB54 4NH -2.74362851648763 57.3505569832833
6 ArranIsleOf 2 3 1 1 0 1 1 1 0 1 1 2 KA27 8HJ -5.27889464413061 55.6991454270982
7 Auchentoshan 0 2 0 0 0 1 1 0 2 2 3 3 G81 4SJ -4.43933887549542 55.9223730962849
8 Auchroisk 2 3 1 0 0 2 1 2 2 2 2 1 AB55 3XS -2.9908649053478 57.523871926781
9 Aultmore 2 2 1 0 0 1 0 0 2 2 2 2 AB55 3QY -2.9908649053478 57.523871926781
10 Balblair 2 3 2 1 0 0 2 0 2 1 2 1 IV19 1LB -4.17774918666713 57.8427350006672
11 Balmenach 4 3 2 0 0 2 1 3 3 0 1 2 PH26 3PF -3.53365578129333 57.3257094050057
12 Belvenie 3 2 1 0 0 3 2 1 0 2 2 2 AB55 4DH -3.1234966962616 57.45284420338
13 BenNevis 4 2 2 0 0 2 2 0 2 2 2 2 PH33 6TJ -5.07341796092794 56.83495218623
14 Benriach 2 2 1 0 0 2 2 0 0 2 3 2 IV30 8SJ -3.28278923249236 57.6088927727877
15 Benrinnes 3 2 2 0 0 3 1 1 2 3 2 2 AB38 9NN -3.23783921683323 57.4435083974772
16 Benromach 2 2 2 0 0 2 2 1 2 2 2 2 IV36 3EB -3.61976440923869 57.6137370207417
17 Bladnoch 1 2 1 0 0 0 1 1 0 2 2 3 DG8 9AB -4.45894926576165 54.8581926006122
18 BlairAthol 2 2 2 0 0 1 2 2 2 2 2 2 PH16 5LY -3.71854407889772 56.6980633824523
19 Bowmore 2 2 3 1 0 2 2 1 1 1 1 2 PA43 7GS -6.28380622015575 55.7560243235292
20 Bruichladdich 1 1 2 2 0 2 2 1 2 2 2 2 PA49 7UN -6.35936447624248 55.7684732961105
21 Bunnahabhain 1 2 1 1 0 1 1 1 1 2 2 3 PA46 7RR -6.12365681483146 55.8824749104294
22 Caol Ila 3 1 4 2 1 0 2 0 2 1 1 1 PA46 7RL -6.10936872002279 55.8548039600664
23 Cardhu 1 3 1 0 0 1 1 0 2 2 2 2 AB38 7RY -3.35564513398068 57.470774334806
24 Clynelish 3 2 3 3 1 0 2 0 1 1 2 0 KW9 6LB -3.85920847682015 58.0136474274183
25 Craigallechie 2 2 2 0 1 2 2 1 2 2 1 4 AB38 9ST -3.18732784488946 57.4889111980938
26 Craigganmore 2 3 2 1 0 0 1 0 2 2 2 2 AB37 9AB -3.38985551931842 57.4100314083573
27 Dailuaine 4 2 2 0 0 1 2 2 2 2 2 1 AB38 7RE -3.27615489132243 57.4529182718081
28 Dalmore 3 2 2 1 0 1 2 2 1 2 3 1 IV17 0UT -4.23912032627334 57.6885606640584
29 Dalwhinnie 2 2 2 0 0 2 1 0 1 2 2 2 PH19 1AB -4.24229278800998 56.9385632569695
30 Deanston 2 2 1 0 0 2 1 1 1 3 2 1 FK16 6AG -4.07106371642032 56.1893763731849
31 Dufftown 2 3 1 1 0 0 0 0 1 2 2 2 AB55 4BR -3.12837439525495 57.4380680004675
32 Edradour 2 3 1 0 0 2 1 1 4 2 2 2 PH16 5JP -3.70073598822836 56.7015425111544
33 GlenDeveronMacduff 2 3 1 1 1 1 1 2 0 2 0 1 AB4 3JT -2.46854696867129 57.632679312173
34 GlenElgin 2 3 1 0 0 2 1 1 1 1 2 3 IV30 3SL -3.29719257711162 57.632641349649
35 GlenGarioch 2 1 3 0 0 0 3 1 0 2 2 2 AB51 0ES -2.31694328453615 57.3384319721492
36 GlenGrant 1 2 0 0 0 1 0 1 2 1 2 1 AB38 7BS -3.21055671687761 57.5304628917816
37 GlenKeith 2 3 1 0 0 1 2 1 2 1 2 1 AB55 3BU -2.9908649053478 57.523871926781
38 GlenMoray 1 2 1 0 0 1 2 1 2 2 2 4 IV30 1YE -3.34482894299557 57.6436422821353
39 GlenOrd 3 2 1 0 0 1 2 1 1 2 2 2 IV6 7UJ -4.47618505184996 57.523563684805
40 GlenScotia 2 2 2 2 0 1 0 1 2 2 1 1 PA28 6DS -5.6037372950766 55.4298098681784
41 GlenSpey 1 3 1 0 0 0 1 1 1 2 0 2 AB38 7AU -3.20792464163303 57.5266252887908
42 Glenallachie 1 3 1 0 0 1 1 0 1 2 2 2 AB38 9LR -3.22674361683977 57.4554750292461
43 Glendronach 4 2 2 0 0 2 1 4 2 2 2 0 AB54 6DA -2.64892748724793 57.4929202873225
44 Glendullan 3 2 1 0 0 2 1 2 1 2 3 2 AB55 4DJ -3.11801722586282 57.4480419456065
45 Glenfarclas 2 4 1 0 0 1 2 3 2 3 2 2 AB37 9BD -3.31804910419333 57.4268839320968
46 Glenfiddich 1 3 1 0 0 0 0 0 0 2 2 2 AB55 4DH -3.1234966962616 57.45284420338
47 Glengoyne 1 2 0 0 0 1 1 1 2 2 3 2 G63 9LB -4.36270646756899 56.0150016657605
48 Glenkinchie 1 2 1 0 0 1 2 0 0 2 2 2 EH34 5ET -2.89084527354656 55.8901172461237
49 Glenlivet 2 3 1 0 0 2 2 2 1 2 2 3 AB37 9DB -3.33811628381529 57.3424053650924
50 Glenlossie 1 2 1 0 0 1 2 0 1 2 2 2 IV30 3SS -3.29719257711162 57.632641349649
51 Glenmorangie 2 2 1 1 0 1 2 0 2 1 2 2 IV19 1PZ -4.07673460011579 57.8235848757463
52 Glenrothes 2 3 1 0 0 1 1 2 1 2 2 0 AB38 7AA -3.20976988773717 57.5268771130244
53 Glenturret 2 3 1 0 0 2 2 2 2 2 1 2 PH7 4HA -3.8541939683654 56.3906029825183
54 Highland Park 2 2 3 1 0 2 1 1 1 2 1 1 KW15 1SU -2.95221548180359 58.9670102197658
55 Inchgower 1 3 1 1 0 2 2 0 1 2 1 2 AB56 5AB -2.96351977306025 57.661944374023
56 Isle of Jura 2 1 2 2 0 1 1 0 2 1 1 1 PA60 7XT -5.95142776658472 55.8330062348159
57 Knochando 2 3 1 0 0 2 2 1 2 1 2 2 AB38 7RT -3.34381012068479 57.4572459652453
58 Lagavulin 4 1 4 4 1 0 1 2 1 1 1 0 PA42 7DZ -6.12594557673067 55.6356137419999
59 Laphroig 4 2 4 4 1 0 0 1 1 1 0 0 PA42 7DU -6.15312892639383 55.6295685643154
60 Linkwood 2 3 1 0 0 1 1 2 0 1 3 2 IV30 3RD -3.29719257711162 57.632641349649
61 Loch Lomond 1 1 1 1 0 1 1 0 1 2 1 2 G83 0TL -4.57697272312236 55.994260227858
62 Longmorn 3 2 1 0 0 1 1 1 3 3 2 3 IV30 3SJ -3.29719257711162 57.632641349649
63 Macallan 4 3 1 0 0 2 1 4 2 2 3 1 AB38 9RX -3.20737615835112 57.4847681898735
64 Mannochmore 2 1 1 0 0 1 1 1 2 1 2 2 IV30 3SS -3.29719257711162 57.632641349649
65 Miltonduff 2 4 1 0 0 1 0 0 2 1 1 2 IV30 3TQ -3.29719257711162 57.632641349649
66 Mortlach 3 2 2 0 0 2 3 3 2 1 2 2 AB55 4AQ -3.11872673643253 57.4439931652283
67 Oban 2 2 2 2 0 0 2 0 2 2 2 0 PA34 5NH -5.47183272431121 56.4152589375579
68 OldFettercairn 1 2 2 0 1 2 2 1 2 3 1 1 AB30 1YE -2.4793323511307 56.8466257985247
69 OldPulteney 2 1 2 2 1 0 1 1 2 2 2 2 KW1 5BA -3.08526137374596 58.434884480437
70 RoyalBrackla 2 3 2 1 1 1 2 1 0 2 3 2 IV12 5QY -3.90523053200274 57.5376098703061
71 RoyalLochnagar 3 2 2 0 0 2 2 2 2 2 3 1 AB35 5TB -3.21860195976112 57.0344875196781
72 Scapa 2 2 1 1 0 2 1 1 2 2 2 2 KW15 1SE -2.99542118080609 58.9637213789762
73 Speyburn 2 4 1 0 0 2 1 0 0 2 1 2 AB38 7AG -3.22246891555061 57.5470570328215
74 Speyside 2 2 1 0 0 1 0 1 2 2 2 2 PH21 1NS -4.0021736834127 57.0803868161573
75 Springbank 2 2 2 2 0 2 2 1 2 1 0 1 PA28 6EJ -5.60065920691764 55.4290014240931
76 Strathisla 2 2 1 0 0 2 2 2 3 3 3 2 AB55 3BS -2.9908649053478 57.523871926781
77 Strathmill 2 3 1 0 0 0 2 0 2 1 3 2 AB55 5DQ -2.95965616243534 57.5409741820447
78 Talisker 4 2 3 3 0 1 3 0 1 2 2 0 IV47 8SR -6.35216607075322 57.3010510515989
79 Tamdhu 1 2 1 0 0 2 0 1 1 2 2 2 AB38 7RP -3.34820487937154 57.4589059244886
80 Tamnavulin 1 3 2 0 0 0 2 0 2 1 2 3 AB37 9JA -3.31035480377158 57.3187110010405
81 Teaninich 2 2 2 1 0 0 2 0 0 0 2 2 IV17 0XB -4.2602870607706 57.6916884852814
82 Tobermory 1 1 1 0 0 1 0 0 1 2 2 2 PA75 6NR -6.06953047203131 56.6208059800594
83 Tomatin 2 3 2 0 0 2 2 1 1 2 0 1 IV13 7YT -4.01003138482344 57.3411014126826
84 Tomintoul 0 3 1 0 0 2 2 1 1 2 1 2 AB37 9AQ -3.41108287276711 57.3126800856074
85 Tormore 2 2 1 0 0 1 0 1 2 1 0 0 PH26 3LR -3.41299586766198 57.3971068082939
86 Tullibardine 2 3 0 0 1 0 2 1 1 2 2 1 PH4 1QG -3.78228953257721 56.2592956448122
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment