Skip to content

Instantly share code, notes, and snippets.

@dwskau
Created January 5, 2013 15:00
Show Gist options
  • Save dwskau/4461976 to your computer and use it in GitHub Desktop.
Save dwskau/4461976 to your computer and use it in GitHub Desktop.
Periodic Table Melting
{"description":"Periodic Table Melting","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"periodictabledump3.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"tab":"edit","display_percent":0.503029944924786,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"hidepanel":false}
var svg = d3.select("svg");
var clist = new Object();
clist.Hydrogen = "#EA3445"
clist.Noble_gas = "#7BC9F0"
clist.Alkali_metals = "#F88437"
clist.Alkaline_earth_metals = "#0FD3BB"
clist.Semiconductors = "#B9C5B9"
clist.Other_nonmetals = "#5EA4C7"
clist.Halogens = "#CB71FD"
clist.Other_metals = "#09C4E7"
clist.Transition_metals = "#A6BCC4"
clist.Transition_metals2 = "#C4D6BA"
clist.vague = "#9B9B9B"
var base_width = 45,
spacing = 4,
rounding = 5,
border_width = 1.44 + "px";
// deeper element json at
// https://gist.github.com/4356217
// traced from: http://www.pnathan.com/elements.json
// minor modifications included.
/*
d3.csv("data/periodictabledump3.csv", function(csv){
data = csv;
main(data);
});
*/
var data = tributary.periodictabledump3
main(data)
function get_location(d){
var x = 20 + ((base_width+spacing) * parseInt(d.group));
var y = 20 + ((base_width+spacing) * parseInt(d.row));
return "translate(" + [x, y] + ")";
}
function main(data){
var group1 = svg.append("g").classed("group1", true)
var blocks = group1.selectAll("g").data(data)
.enter()
.append("g")
.attr("transform", function(d,i){ return get_location(d)})
var rects = blocks.append("rect")
.attr({
"x": 0,
"y": 0,
"width": base_width,
"height": base_width,
"rx": rounding,
"ry": rounding
})
.style({
"fill": function(d){
return clist[d.named_type]
},
"fill-opacity": function(d){
v1 = Math.log(d.meltingC)
return Math.log(v1/3)
},
"stroke": function(d){
return clist[d.named_type]
},
"stroke-width": border_width
})
var text_content = blocks.append("text")
.attr({x:3, y:14})
.style({
"fill": "#232323",
"stroke-width": 0 + "px",
"font-size": 1.2 + "em",
"text-anchor": "right",
"alignment-baseline": "middle",
"font-family": "sans-serif"
})
.text(function(d,i){return d.Symbol})
}
At# Mass Name Symbol group type named_type row meltingC boilingC
1 1.00794 Hydrogen H 1 Hydrogen Hydrogen 1 -259.14 -252.87
2 4.002602 Helium He 18 nonmetals Noble_gas 1 -272.2 -268.93
3 6.941 Lithium Li 1 metals Alkali_metals 2 180.50 1342
4 9.012182 Beryllium Be 2 metals Alkaline_earth_metals 2 1287 2471
5 10.811 Boron B 13 metaloids Semiconductors 2 2075 4000
6 12.0107 Carbon C 14 nonmetals Other_nonmetals 2 3550 3825
7 14.0067 Nitrogen N 15 nonmetals Other_nonmetals 2 -210.00 -195.79
8 15.9994 Oxygen O 16 nonmetals Other_nonmetals 2 -218.79 -182.95
9 18.9994 Fluorine F 17 nonmetals Halogens 2 -219.62 -188.12
10 20.1797 Neon Ne 18 nonmetals Noble_gas 2 -248.59 -246.08
11 22.98976928 Sodium Na 1 metals Alkali_metals 3 97.80 883
12 24.305 Magnesium Mg 2 metals Alkaline_earth_metals 3 650 1090
13 26.9815386 Aluminium Al 13 metals Other_metals 3 660.323 2519
14 28.0855 Silicon Si 14 metaloids Semiconductors 3 1414 3265
15 30.973762 Phosphorus P 15 nonmetals Other_nonmetals 3 44.2 277
16 32.065 Sulphur S 16 nonmetals Other_nonmetals 3 115.21 444.6
17 35.453 Chlorine Cl 17 nonmetals Halogens 3 -101.5 -34.04
18 39.948 Argon Ar 18 nonmetals Noble_gas 3 -189.35 -185.85
19 39.0983 Potassium K 1 metals Alkali_metals 4 63.38 759
20 40.078 Calcium Ca 2 metals Alkaline_earth_metals 4 842 1484
21 44.955912 Scandium Sc 3 metals Transition_metals 4 1541 2836
22 47.867 Titanium Ti 4 metals Transition_metals 4 1668 3287
23 50.9415 Vanadium V 5 metals Transition_metals 4 1910 3407
24 51.9961 Chromium Cr 6 metals Transition_metals 4 1907 2671
25 54.938045 Manganese Mn 7 metals Transition_metals 4 1246 2061
26 55.845 Iron Fe 8 metals Transition_metals 4 1538 2861
27 58.933195 Cobalt Co 9 metals Transition_metals 4 1495 2927
28 58.6934 Nickel Ni 10 metals Transition_metals 4 1455 2913
29 63.546 Copper Cu 11 metals Transition_metals 4 1084.62 2562
30 65.38 Zinc Zn 12 metals Transition_metals 4 419.53 907
31 69.723 Gallium Ga 13 metals Other_metals 4 29.7646 2204
32 72.64 Germanium Ge 14 metaloids Semiconductors 4 938.25 2833
33 74.9216 Arsenic As 15 metaloids Semiconductors 4 817 614
34 78.96 Selenium Se 16 nonmetals Other_nonmetals 4 221 685
35 79.904 Bromine Br 17 nonmetals Halogens 4 -7.2 58.8
36 83.798 Krypton Kr 18 nonmetals Noble_gas 4 -157.36 -153.22
37 85.4678 Rubidium Rb 1 metals Alkali_metals 5 39.31 688
38 87.62 Strontium Sr 2 metals Alkaline_earth_metals 5 777 1382
39 88.90585 Yttrium Y 3 metals Transition_metals 5 1526 3336
40 91.224 Zirconium Zr 4 metals Transition_metals 5 1855 4409
41 92.90638 Niobium Nb 5 metals Transition_metals 5 2477 4744
42 95.96 Molybdenum Mo 6 metals Transition_metals 5 2623 4639
43 98 Technetium Tc 7 metals Transition_metals 5 2157 4265
44 101.07 Ruthenium Ru 8 metals Transition_metals 5 2334 4150
45 102.9055 Rhodium Rh 9 metals Transition_metals 5 1964 3695
46 106.42 Palladium Pd 10 metals Transition_metals 5 1554.9 2963
47 107.8682 Silver Ag 11 metals Transition_metals 5 961.78 2162
48 112.411 Cadmium Cd 12 metals Transition_metals 5 321.07 767
49 114.818 Indium In 13 metals Other_metals 5 156.60 2072
50 118.71 Tin Sn 14 metals Other_metals 5 231.93 2602
51 121.76 Antimony Sb 15 metaloids Semiconductors 5 630.63 1587
52 127.6 Tellurium Te 16 metaloids Semiconductors 5 449.51 988
53 126.90447 Iodine I 17 nonmetals Halogens 5 113.7 184.3
54 131.293 Xenon Xe 18 nonmetals Noble_gas 5 -111.7 -108.12
55 132.9054519 Cesium Cs 1 metals Alkali_metals 6 28.44 671
56 137.327 Barium Ba 2 metals Alkaline_earth_metals 6 727 1897
57 138.90547 Lanthanum La 3 metals Transition_metals 6 920 3464
58 140.116 Cerium Ce 5 metals Transition_metals2 9 798 3424
59 140.90765 Praseodymium Pr 6 metals Transition_metals2 9 935 3520
60 144.242 Neodymium Nd 7 metals Transition_metals2 9 1024 3074
61 145 Promethium Pm 8 metals Transition_metals2 9 1042 3000
62 150.36 Samarium Sm 9 metals Transition_metals2 9 1072 1794
63 151.964 Europium Eu 10 metals Transition_metals2 9 822 1529
64 157.25 Gadolinium Gd 11 metals Transition_metals2 9 1312 3273
65 158.92535 Terbium Tb 12 metals Transition_metals2 9 1356 3230
66 162.5001 Dysprosium Dy 13 metals Transition_metals2 9 1412 2567
67 164.93032 Holmium Ho 14 metals Transition_metals2 9 1461 2720
68 167.259 Erbium Er 15 metals Transition_metals2 9 1529 2868
69 168.93421 Thulium Tm 16 metals Transition_metals2 9 1545 1950
70 173.054 Ytterbium Yb 17 metals Transition_metals2 9 824 1196
71 174.9668 Lutetium Lu 18 metals Transition_metals2 9 1663 3402
72 178.49 Hafnium Hf 4 metals Transition_metals 6 2233 4603
73 180.94788 Tantalum Ta 5 metals Transition_metals 6 3017 5458
74 183.84 Tungsten W 6 metals Transition_metals 6 3422 5555
75 186.207 Rhenium Re 7 metals Transition_metals 6 3186 5596
76 190.23 Osmium Os 8 metals Transition_metals 6 3033 5012
77 192.217 Iridium Ir 9 metals Transition_metals 6 2446 4428
78 192.084 Platinum Pt 10 metals Transition_metals 6 1768.3 3825
79 196.966569 Gold Au 11 metals Transition_metals 6 1064.18 2856
80 200.59 Mercury Hg 12 metals Transition_metals 6 -38.83 356.73
81 204.3833 Thallium Tl 13 metals Other_metals 6 304 1473
82 207.2 Lead Pb 14 metals Other_metals 6 327.46 1749
83 208.980401 Bismuth Bi 15 metals Other_metals 6 271.40 1564
84 210 Polonium Po 16 metals Other_metals 6 254 962
85 210 Astatine At 17 nonmetals Halogens 6 302 ? 337
86 220 Radon Rn 18 nonmetals Noble_gas 6 -71.15 -61.85
87 223 Francium Fr 1 metals Alkali_metals 7 ? 27 ? 677
88 226 Radium Ra 2 metals Alkaline_earth_metals 7 700 1737
89 227 Actinium Ac 3 metals Transition_metals 7 1050 3198
90 232.03806 Thorium Th 5 metals Transition_metals2 10 1842 4788
91 231.03588 Protactinium Pa 6 metals Transition_metals2 10 1568 Unknown
92 238.02891 Uranium U 7 metals Transition_metals2 10 1132.2 4131
93 237 Neptunium Np 8 metals Transition_metals2 10 Unknown Unknown
94 244 Plutonium Pu 9 metals Transition_metals2 10 639.4 3228
95 243 Americium Am 10 metals Transition_metals2 10 1176 2011°C
96 247 Curium Cm 11 metals Transition_metals2 10 1340 3110
97 247 Berkelium Bk 12 metals Transition_metals2 10 1050 Unknown
98 251 Californium Cf 13 metals Transition_metals2 10 900 Unknown
99 252 Einsteinium Es 14 metals Transition_metals2 10 860 Unknown
100 257 Fermium Fm 15 metals Transition_metals2 10 1527 Unknown
101 258 Mendelevium Md 16 metals Transition_metals2 10 827 Unknown
102 259 Nobelium No 17 metals Transition_metals2 10 827 Unknown
103 262 Lawrencium Lr 18 metals Transition_metals2 10 1627 Unknown
104 261 Rutherfordium Rf 4 metals Transition_metals 7 Unknown Unknown
105 262 Dubnium Db 5 metals Transition_metals 7 Unknown Unknown
106 266 Seaborgium Sg 6 metals Transition_metals 7 Unknown Unknown
107 264 Bohrium Bh 7 metals Transition_metals 7 Unknown Unknown
108 277 Hassium Hs 8 metals Transition_metals 7 Unknown Unknown
109 268 Meitnerium Mt 9 metals Transition_metals 7 Unknown Unknown
110 271 Darmstadtium Ds 10 metals Transition_metals 7 Unknown Unknown
111 272 Roentgenium Rg 11 metals Transition_metals 7 Unknown Unknown
112 285 Ununbium Uub 12 future vague 7 Unknown Unknown
113 284 Ununtrium Uut 13 future vague 7 Unknown Unknown
114 289 Ununquadium Uuq 14 future vague 7 Unknown Unknown
115 288 Ununpentium Uup 15 future vague 7 Unknown Unknown
116 292 Ununhexium Uuh 16 future vague 7 Unknown Unknown
118 294 Ununoctium Uuo 17 future vague 7 Unknown Unknown
/*
http://lesscss.org/ Pragmatic Theme by Dealga McArdle
After original "Dark Theme" ported to CodeMirror by Peter Kroon
*/
.cm-s-lesser-dark {
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important;
line-height: 1.26em;
}
.cm-s-lesser-dark.CodeMirror { background: #1e2426; color: #EEEEEE; }
.cm-s-lesser-dark div.CodeMirror-selected {background: #065357 !important;} /* 33322B*/
.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-lesser-dark pre { padding: 0 8px; line-height: 1.3em; }/*editable code holder*/
div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
.cm-s-lesser-dark span.cm-keyword { color: DeepSkyBLue; }
.cm-s-lesser-dark span.cm-atom { color: #8CEEF7; font-weight: bold}
.cm-s-lesser-dark span.cm-number { color: Chartreuse; background: #000000;}
.cm-s-lesser-dark span.cm-def {color: #C4D8E6;}
.cm-s-lesser-dark span.cm-variable { color:#AAA; }
.cm-s-lesser-dark span.cm-variable-2 { color: #9DCFD8; }
.cm-s-lesser-dark span.cm-variable-3 { color: white; }
.cm-s-lesser-dark span.cm-property {color: #FFB78F;}
.cm-s-lesser-dark span.cm-operator {color: #92A75C;}
.cm-s-lesser-dark span.cm-comment { color: #FEFEFE; background: #060606; opacity: .6}
.cm-s-lesser-dark span.cm-string { color: Chartreuse; background: #424242;}
.cm-s-lesser-dark span.cm-string-2 {color: Chartreuse; background: #7E7E7E;}
.cm-s-lesser-dark span.cm-meta { color: #738C73; }
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
.cm-s-lesser-dark span.cm-qualifier {color: #000555; }
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
.cm-s-lesser-dark span.cm-tag { color: #669199; }
.cm-s-lesser-dark span.cm-attribute {color: #00c;}
.cm-s-lesser-dark span.cm-header {color: #a0a;}
.cm-s-lesser-dark span.cm-quote {color: #090;}
.cm-s-lesser-dark span.cm-hr {color: #999;}
.cm-s-lesser-dark span.cm-link {color: #00c;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment