Skip to content

Instantly share code, notes, and snippets.

@fabiomainardi
fabiomainardi / README.md
Last active September 29, 2015 05:19
Stacked area chart with multiple tooltips

Adapted from Mike Bostock's block http://bl.ocks.org/mbostock/3885211. The tooltips are drawn on an invisible rectangle with CSS class .overlay { fill: none; pointer-events: all; } The technique is borrowed from mbostock’s block #3902569

@fabiomainardi
fabiomainardi / census.csv
Last active September 27, 2015 10:43
US Population pyramid 1890-2000
year age female male
1850 0 1483789 1450376
1850 5 1411067 1359668
1850 10 1260099 1216114
1850 15 1077133 1110619
1850 20 1017281 1003841
1850 25 862547 799482
1850 30 730638 639636
1850 35 588487 505012
1850 40 475911 428185
@fabiomainardi
fabiomainardi / README.md
Last active September 25, 2015 11:18
Multiline chart with filter

A simple example of a multiline chart, where lines can be selected or de-selected by clicking on the corresponding legend.

Adapted from an example by Bostock: http://bl.ocks.org/mbostock/3884955

@fabiomainardi
fabiomainardi / README.md
Last active November 10, 2018 09:23
Filtering data

This is a simple development of a an example from the book "Data Visualization with D3.js Cookbook". Its purpose is to illustrate how to use the .filter statement directly in the .data statement:

.data(data.filter(function(d){return d.category == category;}))

@fabiomainardi
fabiomainardi / arules.csv
Last active September 22, 2015 14:41
Association Rules for Data Scientist skills
source target value
Hive SQL 0.755102040816
MatLab Python 0.875
Hive Python 0.734693877551
STATA SQL 0.761904761905
R Python 0.70618556701
STATA Python 0.714285714286
@fabiomainardi
fabiomainardi / FrequentSkills.csv
Last active June 23, 2018 04:10
Frequent skills required for data science jobs
Skills Value Category
SQL 488 DatabaseSoftware
Python 367 ProgrammingLanguage
R 194 StatisticSoftware
SAS 163 StatisticSoftware
Pig 123 CloudSoftware
SPSS 110 StatisticSoftware
Hadoop 94 CloudSoftware
Java/Javascript 73 ProgrammingLanguage
MapReduce/Elastic MapReduce 72 CloudSoftware
@fabiomainardi
fabiomainardi / data.csv
Last active September 21, 2015 14:06
Percentage of fossile fuel usage in the world
Country Value
Congo 4.2
Ethiopia 5.7
Zambia 8.8
Mozambique 9.5
Tanzania 10.7
Nepal 12.5
Togo 15.2
Iceland 15.3
Nigeria 17.4
@fabiomainardi
fabiomainardi / d3.slider.css
Last active September 17, 2015 13:25
City Prosperity Index, with Slider
.d3-slider {
position: relative;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
border: 1px solid #aaaaaa;
z-index: 2;
}
.d3-slider-horizontal {
height: .8em;
@fabiomainardi
fabiomainardi / data.csv
Last active September 15, 2015 05:11
City Prosperity Index
City lon lat Infrastructure_Index Country Quality_of_Life_Index CPI-4 CPI-5 Environmental_Index ukey Productivity_Index Equity_Index
Vienna 16.374 48.208 0.996 Austria 0.882 0.936 0.925 0.932 Austria-Vienna 0.939 0.883
New York -74.006 40.713 0.994 United States 0.866 0.934 0.825 0.941 United States-New York 0.94 0.502
Toronto -79.383 43.653 0.997 Canada 0.907 0.934 0.89 0.963 Canada-Toronto 0.874 0.733
London -0.100 51.520 0.997 United Kingdom 0.898 0.934 0.904 0.92 United Kingdom-London 0.923 0.793
Stockholm 18.070 59.330 0.995 Sweden 0.925 0.934 0.898 0.921 Sweden-Stockholm 0.896 0.767
Helsinki 24.940 60.170 0.997 Finland 0.905 0.933 0.924 0.944 Finland-Helsinki 0.89 0.89
Dublin -6.250 53.330 0.996 Ireland 0.867 0.929 0.913 0.958 Ireland-Dublin 0.901 0.85
Oslo 10.750 59.910 0.997 Norway 0.914 0.929 0.924 0.939 Norway-Oslo 0.87 0.903
Paris 2.340 48.860 0.996 France 0.925 0.927 0.897 0.895 France-Paris 0.895 0.788
Vienna 16.374 48.208 0.996 Austria 0.882 0.936 0.925 0.932 Austria-Vienna 0.939 0.883
New York -74.006 40.713 0.994 United States 0.866 0.934 0.825 0.941 United States-New York 0.94 0.502
Toronto -79.383 43.653 0.997 Canada 0.907 0.934 0.89 0.963 Canada-Toronto 0.874 0.733
London -0.100 51.520 0.997 United Kingdom 0.898 0.934 0.904 0.92 United Kingdom-London 0.923 0.793
Stockholm 18.070 59.330 0.995 Sweden 0.925 0.934 0.898 0.921 Sweden-Stockholm 0.896 0.767
Helsinki 24.940 60.170 0.997 Finland 0.905 0.933 0.924 0.944 Finland-Helsinki 0.89 0.89
Dublin -6.250 53.330 0.996 Ireland 0.867 0.929 0.913 0.958 Ireland-Dublin 0.901 0.85
Oslo 10.750 59.910 0.997 Norway 0.914 0.929 0.924 0.939 Norway-Oslo 0.87 0.903
Paris 2.340 48.860 0.996 France 0.925 0.927 0.897 0.895 France-Paris 0.895 0.788