Skip to content

Instantly share code, notes, and snippets.

@rveciana
Last active March 1, 2016 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rveciana/e3c02fe71f8dc63041ea to your computer and use it in GitHub Desktop.
Save rveciana/e3c02fe71f8dc63041ea to your computer and use it in GitHub Desktop.
People at risk of poverty or social exclusion by NUTS 2 regions
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.border {
stroke: #000;
fill: none;
}
.graticule {
fill: none;
stroke: #777;
stroke-width: .5px;
stroke-opacity: .5;
}
div.tooltip {
position: absolute;
text-align: center;
width: 84px;
height: 64px;
padding: 2px;
font: 12px sans-serif;
background: lightgrey;
border: 0px;
border-radius: 8px;
pointer-events: none;
}
</style>
<body>
<h1>People at risk of poverty or social exclusion by NUTS 2 regions</h1>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://d3js.org/colorbrewer.v1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3-composite-projections/0.3.5/conicConformalEurope-proj.min.js"></script>
<script>
var div = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
var width = 600,
height = 500;
var projection = d3.geo.conicConformalEurope();
var graticule = d3.geo.graticule();
var path = d3.geo.path()
.projection(projection);
var scale = d3.scale.quantize().domain([10,60]).range(colorbrewer.OrRd[9]);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.append("path")
.datum(graticule)
.attr("class", "graticule")
.attr("d", path);
d3.json("https://cdn.rawgit.com/rveciana/5919944/raw//nuts2.json", function(error, europe) {
d3.csv("povertry_rate.csv", function(error, povrate) {
var land = topojson.feature(europe, europe.objects.nuts2);
data = {};
povrate.forEach(function(d) {
data[d.GEO] = d['2013'];
});
console.info(data);
svg.selectAll("path")
.data(land.features)
.enter()
.append("path")
.attr("d", path)
.style("stroke","#000")
.style("stroke-width",".5px")
.style("fill",function(d){
var value = data[d.id];
if (isNaN(value)){
value = data[d.id.substring(0,2)];
}
if (isNaN(value)){
return "#fff";
}
return scale(value);
})
.on("mouseover", function(d,i) {
var value = data[d.id];
if (isNaN(value)){
value = data[d.id.substring(0,2)];
}
div.transition()
.duration(200)
.style("opacity", 0.9);
div.html("<b>"+d.properties.name+"</b><br/>" + value + "%")
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
})
.on("mouseout", function(d,i) {
div.transition()
.duration(500)
.style("opacity", 0);
});
svg
.append("path")
.style("fill","none")
.style("stroke","#000")
.attr("d", projection.getCompositionBorders());
});
});
</script>
GEO GEO(L)/TIME 2010 2011 2012 2013 2014
BE Belgium 20.8 21.0 21.6 20.8 21.2
BE1 Région de Bruxelles-Capitale / Brussels Hoofdstedelijk Gewest 40.2 40.4 : : :
BE2 Vlaams Gewest 14.8 15.0 : : :
BE3 Région wallonne 25.7 25.4 : : :
BG Bulgaria 49.2 49.1 49.3 48.0 40.1
BG3 Severna i yugoiztochna Bulgaria 53.8 54.5 53.7 51.8 44.0
BG31 Severozapaden 53.3 53.9 52.6 52.8 46.1
BG32 Severen tsentralen 58.7 59.5 53.9 48.4 43.7
BG33 Severoiztochen 52.7 52.1 51.0 54.7 45.6
BG34 Yugoiztochen 51.1 53.2 56.7 51.1 41.2
BG4 Yugozapadna i yuzhna tsentralna Bulgaria 44.2 43.3 44.6 44.1 36.1
BG41 Yugozapaden 36.9 37.4 39.1 37.1 28.6
BG42 Yuzhen tsentralen 54.3 51.6 52.6 54.2 46.9
CZ Czech Republic 14.4 15.3 15.4 14.6 :
CZ01 Praha 7.1 9.1 12.5 10.2 :
CZ02 Strední Cechy 12.4 9.6 12.3 9.9 :
CZ03 Jihozápad 13.6 14.6 12.4 11.5 :
CZ04 Severozápad 21.3 24.6 23.7 25.8 :
CZ05 Severovýchod 11.4 13.8 13.2 13.8 :
CZ06 Jihovýchod 15.0 14.2 13.7 11.1 :
CZ07 Strední Morava 16.3 16.4 16.0 14.7 :
CZ08 Moravskoslezsko 18.9 22.0 20.9 22.9 :
DK Denmark 18.3 18.9 19.0 18.9 17.8
DK01 Hovedstaden 20.0 17.4 19.2 16.4 18.4
DK02 Sjælland 16.0 17.5 19.2 13.8 18.0
DK03 Syddanmark 16.9 21.5 19.1 18.8 17.7
DK04 Midtjylland 19.7 19.3 19.5 22.8 17.9
DK05 Nordjylland 17.2 17.4 16.4 22.4 16.3
DE Germany (until 1990 former territory of the FRG) 19.7 19.9 19.6 20.3 :
EE Estonia 21.7 23.1 23.4 23.5 :
IE Ireland 27.3 29.4 30.0 29.5 :
IE01 Border, Midland and Western 28.8 33.2 34.7 36.6 :
IE02 Southern and Eastern 26.7 28.0 28.3 27.0 :
EL Greece 27.7 31.0 34.6 35.7 36.0
EL1 Voreia Ellada (NUTS 2010) 31.5 : : 36.0 37.1
EL2 Kentriki Ellada (NUTS 2010) 33.0 : : 39.3 40.5
EL3 Attiki 23.1 : : 34.0 31.6
EL4 Nisia Aigaiou, Kriti 23.9 : : 33.7 39.4
ES Spain 26.1 26.7 27.2 27.3 29.2
ES1 Noroeste (ES) 21.2 21.1 24.0 23.9 24.2
ES11 Galicia 22.7 21.0 23.8 24.3 23.8
ES12 Principado de Asturias 16.5 20.4 24.5 21.8 23.4
ES13 Cantabria 22.5 23.0 24.1 25.3 27.4
ES2 Noreste (ES) 17.1 18.5 17.5 17.7 17.2
ES21 País Vasco 16.3 18.9 17.7 16.8 15.3
ES22 Comunidad Foral de Navarra 13.8 13.1 12.0 14.5 14.5
ES23 La Rioja 27.3 26.1 22.6 22.2 20.1
ES24 Aragón 17.5 18.6 18.4 19.8 20.7
ES3 Comunidad de Madrid 19.3 18.6 19.8 20.1 19.2
ES30 Comunidad de Madrid 19.3 18.6 19.8 20.1 19.2
ES4 Centro (ES) 30.1 29.7 28.7 29.6 32.7
ES41 Castilla y León 23.8 22.3 20.4 20.8 26.1
ES42 Castilla-la Mancha 32.3 35.3 35.1 36.7 36.9
ES43 Extremadura 40.3 36.0 35.2 36.1 39.8
ES5 Este (ES) 23.9 24.3 25.7 25.0 26.7
ES51 Cataluña 19.8 21.6 22.6 20.1 21.8
ES52 Comunidad Valenciana 29.6 27.9 30.6 31.7 34.7
ES53 Illes Balears 26.0 26.7 25.1 27.8 23.8
ES6 Sur (ES) 35.4 37.4 36.2 37.7 42.6
ES61 Andalucía 35.0 38.4 36.9 38.3 42.3
ES62 Región de Murcia 37.5 31.9 33.5 34.1 44.9
ES63 Ciudad Autónoma de Ceuta (ES) 35.9 33.6 38.4 47.0 47.9
ES64 Ciudad Autónoma de Melilla (ES) 35.4 34.7 14.5 31.4 25.8
ES7 Canarias (ES) 35.7 37.8 40.3 35.5 37.0
ES70 Canarias (ES) 35.7 37.8 40.3 35.5 37.0
FR France 19.2 19.3 19.1 18.1 :
HR Croatia 31.1 32.6 32.6 29.9 :
IT Italy 24.5 28.2 29.9 28.4 28.1
ITC Nord-Ovest 16.1 18.1 20.1 18.0 19.1
ITC1 Piemonte 17.8 22.0 21.0 16.8 19.3
ITC2 Valle d'Aosta/Vallée d'Aoste 14.1 12.3 13.5 19.2 16.9
ITC3 Liguria 15.9 20.1 24.0 24.5 26.9
ITC4 Lombardia 15.4 16.1 19.1 17.5 17.9
ITH Nord-Est 13.8 15.5 16.4 16.6 15.7
ITH1 Provincia Autonoma di Bolzano/Bozen 9.9 10.5 14.7 12.3 8.6
ITH2 Provincia Autonoma di Trento 10.3 16.2 19.6 15.4 14.1
ITH3 Veneto 15.0 15.9 15.8 16.1 16.9
ITH4 Friuli-Venezia Giulia 15.8 17.4 21.2 16.7 15.9
ITH5 Emilia-Romagna 12.8 14.9 15.7 17.7 15.2
ITI Centro (IT) 20.0 22.7 24.8 23.3 21.5
ITI1 Toscana 17.5 20.6 22.4 18.3 19.1
ITI2 Umbria 19.2 22.1 23.0 23.3 21.0
ITI3 Marche 17.6 22.3 22.9 23.3 19.8
ITI4 Lazio 22.5 24.2 27.1 26.6 23.5
ITF Sud 39.0 44.9 46.6 44.5 43.3
ITF1 Abruzzo 25.8 29.5 27.4 26.2 29.1
ITF2 Molise 31.8 33.6 36.4 44.8 39.2
ITF3 Campania 44.1 49.3 49.8 49.0 49.0
ITF4 Puglia 35.4 43.3 49.6 43.3 41.1
ITF5 Basilicata 36.2 48.6 47.7 49.2 40.4
ITF6 Calabria 42.0 46.5 45.4 44.9 42.0
ITG Isole 40.4 49.0 50.9 49.4 51.2
ITG1 Sicilia 45.9 54.6 57.8 55.3 55.8
ITG2 Sardegna 23.8 32.2 30.1 31.7 36.9
CY Cyprus 24.6 24.6 27.1 27.8 :
LV Latvia 38.2 40.1 36.2 35.1 32.7
LT Lithuania 34.0 33.1 32.5 30.8 27.3
LU Luxembourg 17.1 16.8 18.4 19.0 :
HU Hungary 29.9 31.0 32.4 33.5 31.1
HU1 Közép-Magyarország 25.4 26.0 28.4 31.8 29.3
HU2 Dunántúl 25.3 27.9 28.2 27.9 26.9
HU3 Alföld és Észak 36.6 37.0 38.7 39.2 35.8
MT Malta 21.2 22.1 23.1 24.0 23.8
NL Netherlands 15.1 15.7 15.0 15.9 :
NL1 Noord-Nederland : 17.6 15.1 16.4 :
NL2 Oost-Nederland : 16.0 14.3 14.1 :
NL3 West-Nederland : 15.8 16.2 17.4 :
NL4 Zuid-Nederland : 14.5 13.0 14.2 :
AT Austria 18.9 19.2 18.5 18.8 19.2
AT11 Burgenland (AT) 14.9 18.7 8.9 : :
AT12 Niederösterreich 12.9 13.3 13.5 : :
AT13 Wien 25.1 27.5 31.6 : :
AT21 Kärnten 19.9 23.0 18.7 : :
AT22 Steiermark 18.2 14.0 17.5 : :
AT31 Oberösterreich 12.4 11.3 13.2 : :
AT32 Salzburg 14.7 13.0 13.8 : :
AT33 Tirol 11.1 15.7 16.0 : :
AT34 Vorarlberg 14.8 12.5 20.7 : :
PL Poland 27.8 27.2 26.7 25.8 24.7
PL1 Region Centralny : : 23.6 23.6 22.6
PL2 Region Poludniowy : : 24.5 24.7 21.7
PL3 Region Wschodni : : 33.4 30.6 29.1
PL4 Region Pólnocno-Zachodni : : 27.1 24.6 24.0
PL5 Region Poludniowo-Zachodni : : 26.6 25.2 24.1
PL6 Region Pólnocny : : 25.8 26.4 27.5
PT Portugal 25.3 24.4 25.3 27.5 :
RO Romania 41.4 40.3 41.7 40.4 :
RO1 Macroregiunea unu 30.6 31.5 31.8 31.8 :
RO11 Nord-Vest 30.8 34.3 31.9 30.9 :
RO12 Centru 30.3 28.5 31.6 32.8 :
RO2 Macroregiunea doi 51.3 50.7 52.1 50.6 :
RO21 Nord-Est 51.0 51.2 52.3 48.9 :
RO22 Sud-Est 51.8 50.0 51.7 53.4 :
RO3 Macroregiunea trei 39.4 37.3 38.9 36.6 :
RO31 Sud - Muntenia 42.7 43.1 43.5 40.9 :
RO32 Bucuresti - Ilfov 34.4 28.4 31.5 30.3 :
RO4 Macroregiunea patru 42.1 39.3 41.9 41.8 :
RO41 Sud-Vest Oltenia 48.0 44.8 46.9 45.6 :
RO42 Vest 35.5 33.1 36.2 37.5 :
SI Slovenia 18.3 19.3 19.6 20.4 20.4
SI01 Vzhodna Slovenija (NUTS 2010) 21.6 22.3 22.5 22.5 22.5
SI02 Zahodna Slovenija (NUTS 2010) 14.7 16.1 16.5 18.1 17.9
SK Slovakia 20.6 20.6 20.5 19.8 18.4
SK01 Bratislavský kraj 13.8 17.1 16.9 19.6 16.5
SK02 Západné Slovensko 18.6 18.1 18.7 17.7 15.4
SK03 Stredné Slovensko 21.1 20.9 22.1 20.0 20.2
SK04 Východné Slovensko 25.2 24.6 22.7 21.9 21.0
FI Finland 16.9 17.9 17.2 16.0 17.3
FI1 Manner-Suomi 16.9 18.0 17.2 15.9 17.2
FI13 Itä-Suomi (NUTS 2006) : : : : :
FI18 Etelä-Suomi (NUTS 2006) : : : : :
FI19_20 Länsi-Suomi, Åland 16.6 18.9 18.6 16.0 17.7
FI1A Pohjois-Suomi (NUTS 2006) : : : : :
FI1B Helsinki-Uusimaa 13.9 13.8 11.3 11.6 12.6
FI1C Etelä-Suomi 18.0 19.2 18.8 17.5 18.0
FI1D Pohjois- ja Itä-Suomi 19.5 20.6 21.2 19.7 21.6
FI2 Åland 9.1 11.7 20.5 25.5 20.2
SE Sweden 15.0 16.1 15.7 16.4 :
SE1 Östra Sverige 13.9 15.1 13.8 14.7 :
SE11 Stockholm 12.3 13.6 11.6 12.4 :
SE12 Östra Mellansverige 15.7 16.7 16.4 17.3 :
SE2 Södra Sverige 15.8 17.0 16.6 17.5 :
SE21 Småland med öarna 16.2 17.3 16.0 18.0 :
SE22 Sydsverige 16.8 17.3 18.5 19.9 :
SE23 Västsverige 15.0 16.7 15.6 15.7 :
SE3 Norra Sverige 15.3 16.1 17.5 17.6 :
SE31 Norra Mellansverige 17.9 16.4 16.9 19.4 :
SE32 Mellersta Norrland 10.9 17.3 17.6 18.7 :
SE33 Övre Norrland 15.1 14.8 18.2 14.0 :
UK United Kingdom 23.2 22.7 24.1 24.8 :
IS Iceland 13.7 13.7 12.7 13.0 :
NO Norway 14.9 14.5 13.8 14.2 :
NO01 Oslo og Akershus 13.2 14.6 13.9 15.2 :
NO02 Hedmark og Oppland 15.5 12.5 14.3 14.4 :
NO03 Sør-Østlandet 15.8 14.2 12.9 14.0 :
NO04 Agder og Rogaland 15.2 15.2 12.7 11.9 :
NO05 Vestlandet 12.3 13.1 13.3 12.5 :
NO06 Trøndelag 18.4 16.3 15.5 17.4 :
NO07 Nord-Norge 17.5 16.6 15.2 15.0 :
CH Switzerland 17.2 17.2 17.5 16.3 :
CH01 Région lémanique 20.0 21.5 18.3 15.6 :
CH02 Espace Mittelland 21.3 20.3 21.3 19.7 :
CH03 Nordwestschweiz 11.9 14.4 14.6 13.2 :
CH04 Zürich 12.2 13.0 11.9 12.1 :
CH05 Ostschweiz 16.1 15.9 18.0 17.9 :
CH06 Zentralschweiz 15.7 12.3 14.4 13.7 :
CH07 Ticino 26.8 22.7 32.9 30.2 :
MK Former Yugoslav Republic of Macedonia, the : : 50.3 48.1 :
RS Serbia : : : 42.0 :
TR Turkey : : : : :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment