Skip to content

Instantly share code, notes, and snippets.

@diN0bot
Forked from mbostock/.block
Last active December 24, 2015 22:59
Show Gist options
  • Save diN0bot/6876406 to your computer and use it in GitHub Desktop.
Save diN0bot/6876406 to your computer and use it in GitHub Desktop.

This is a recreation (for the purpose of tinkering with a simplified version) of Lane Harrison’s Exoplanets interactive, which was inspired by Randall Munroe’s XKCD comic. The data is from the Planetary Habilitability Laboratory.

D3’s pack layout places circles so that they touch by default. The XKCD version however uses padding, which is more aesthetically pleasing. Fortunately, D3 2.10’s pack layout now supports padding. You could achieve a similar result through collision detection, but the pack layout is faster to compute. My implementation uses a quantize scale for color, which is my best guess to what’s used in the original, but I can’t know for sure. I make no guarantees to the accuracy of this chart. I also removed extra dimensions to reduce the size of the data file, but as a consequence I can’t show additional details on mouseover.

Test

name radius
11 Com b 12.58
11 UMi b 12.83
14 And b 13.17
14 Her b 13.18
16 Cyg B b 13.63
18 Del b 12.84
1RXS1609 b 19.06
24 Sex b 13.55
24 Sex c 13.93
2M 044144 b 12.98
2M 0746+20 b 10.87
2M 2140+16 b 10.31
2M 2206-20 b 14.57
2M1207 b 13.25
30 Ari B b 12.86
4 Uma b 13
42 Dra b 13.26
47 Uma b 13.45
47 Uma c 14.14
47 Uma d 13.64
51 Peg b 14.28
55 Cnc b 13.95
55 Cnc c 9.19
55 Cnc d 13.33
55 Cnc e 2.17
55 Cnc f 8.4
6 Lyn b 13.53
61 Vir b 2.02
61 Vir c 5.01
61 Vir d 5.7
7 CMa b 13.43
70 Vir b 13.03
81 Cet b 13.12
91 Aqr b 13.39
AB Pic b 12.73
BD +48 738 b 13.9
BD-082823 b 4.38
BD-082823 c 14.37
BD-10 3166 b 14.2
BD-17 63 b 13.14
BD14 4559 b 13.69
BD20 2457 b 12.54
BD20 2457 c 12.76
CD-35 2722 b 12.39
CFBDS 1458 b 13.04
CHXR 73 b 12.78
CT Cha b 24.66
CoRoT-1 b 16.7
CoRoT-10 b 10.87
CoRoT-11 b 16.03
CoRoT-12 b 16.14
CoRoT-13 b 9.92
CoRoT-14 b 12.22
CoRoT-16 b 13.11
CoRoT-17 b 11.43
CoRoT-18 b 14.68
CoRoT-19 b 16.25
CoRoT-2 b 16.42
CoRoT-20 b 9.42
CoRoT-21 b 14.57
CoRoT-23 b 11.77
CoRoT-3 b 11.32
CoRoT-4 b 13.34
CoRoT-5 b 15.56
CoRoT-6 b 13.07
CoRoT-7 b 1.68
CoRoT-7 c 3.25
CoRoT-8 b 6.39
CoRoT-9 b 11.77
DH Tau b 12.81
DP Leo b 13.07
FU Tau b 12.68
Fomalhaut b 13.37
GJ 1214 b 2.75
GJ 176 b 3.26
GJ 3021 b 13.32
GJ 317 b 13.66
GJ 317 c 13.55
GJ 3634 b 2.2
GJ 433 b 2.15
GJ 433 c 8.27
GJ 436 b 4.09
GJ 667C b 2.09
GJ 667C c 1.86
GJ 674 b 3.92
GJ 676A b 13.25
GJ 832 b 14.06
GQ Lup b 20.18
GSC 06214-00210 b 12.63
Gj 849 b 13.87
Gl 179 b 13.95
Gl 581 b 4.65
Gl 581 c 2.08
Gl 581 d 2.2
Gl 581 e 1.34
Gl 649 b 14.38
Gl 86 b 13.24
Gliese 876 b 13.56
Gliese 876 c 14.08
Gliese 876 d 2.15
Gliese 876 e 4.09
HAT-P-1 b 13.64
HAT-P-11 b 5.07
HAT-P-12 b 10.75
HAT-P-13 b 14.35
HAT-P-13 c 12.7
HAT-P-14 b 13.45
HAT-P-15 b 12.02
HAT-P-16 b 14.45
HAT-P-17 b 11.32
HAT-P-17 c 13.71
HAT-P-18 b 11.15
HAT-P-19 b 12.69
HAT-P-2 b 10.66
HAT-P-20 b 9.72
HAT-P-21 b 11.48
HAT-P-22 b 12.11
HAT-P-23 b 15.33
HAT-P-24 b 13.92
HAT-P-25 b 13.34
HAT-P-26 b 6.33
HAT-P-27/WASP-40 b 11.83
HAT-P-28 b 13.59
HAT-P-29 b 12.41
HAT-P-3 b 9.27
HAT-P-30/WASP-51 b 15.02
HAT-P-31 b 11.99
HAT-P-32 b 22.83
HAT-P-33 b 20.48
HAT-P-34 b 12.41
HAT-P-35 b 14.93
HAT-P-36 b 14.17
HAT-P-37 b 13.2
HAT-P-38 b 9.25
HAT-P-4 b 14.24
HAT-P-5 b 14.03
HAT-P-6 b 14.91
HAT-P-7 b 15.93
HAT-P-8 b 16.81
HAT-P-9 b 15.69
HATS-1 b 14.59
HD 100655 b 13.62
HD 100777 b 13.79
HD 10180 c 4.17
HD 10180 d 3.92
HD 10180 e 6
HD 10180 f 5.84
HD 10180 g 5.49
HD 10180 h 10.17
HD 101930 b 14.42
HD 102117 b 9.28
HD 102195 b 14.23
HD 102272 b 13.08
HD 102272 c 13.43
HD 102329 b 13.08
HD 102365 b 4.65
HD 102956 b 13.88
HD 103197 b 6.77
HD 104067 b 9.69
HD 104985 b 13.05
HD 106252 b 13.03
HD 106270 b 12.81
HD 10647 b 13.89
HD 106515A b 12.83
HD 10697 b 13.11
HD 107148 b 10.37
HD 108147 b 11.72
HD 108863 b 13.43
HD 108874 b 13.72
HD 108874 c 13.85
HD 109246 b 13.98
HD 109749 b 14.45
HD 110014 b 12.81
HD 111232 b 13.02
HD 113538 b 11.94
HD 113538 c 14.02
HD 114386 b 13.76
HD 114386 c 13.78
HD 114729 b 13.94
HD 114762 b 12.81
HD 114783 b 13.93
HD 11506 b 13.31
HD 11506 c 13.95
HD 116029 b 13.53
HD 117207 b 13.54
HD 117618 b 9.46
HD 118203 b 13.52
HD 11964 b 14.08
HD 11964 c 6
HD 11977 b 13.03
HD 121504 b 13.77
HD 122430 b 13.28
HD 125595 b 4.21
HD 125612 b 13.37
HD 125612 c 5.05
HD 125612 d 12.99
HD 126525 b 10.76
HD 12661 b 13.49
HD 12661 c 13.66
HD 126614 b 14.31
HD 128311 b 13.51
HD 128311 c 13.4
HD 129445 b 13.65
HD 130322 b 13.92
HD 131496 b 13.51
HD 13189 b 12.71
HD 132406 b 13.1
HD 132563B b 13.68
HD 134060 b 3.81
HD 134060 c 8.62
HD 134606 b 3.44
HD 134606 c 4
HD 134606 d 7.62
HD 134987 b 13.65
HD 134987 c 13.95
HD 136352 b 2.06
HD 136352 c 3.85
HD 136352 d 3.49
HD 136418 b 13.55
HD 137388 b 10.73
HD 13808 b 3.65
HD 13808 c 3.86
HD 13931 b 13.58
HD 139357 b 12.86
HD 141937 b 12.87
HD 142 b 13.76
HD 142 c 13.12
HD 142022 A b 13.2
HD 142245 b 13.57
HD 142415 b 13.64
HD 143361 b 13.35
HD 145377 b 13.09
HD 145457 b 13.39
HD 1461 b 2.49
HD 1461 c 2.18
HD 147018 b 13.52
HD 147018 c 13.03
HD 147513 b 13.77
HD 148156 b 13.93
HD 148427 b 13.88
HD 149026 b 8.05
HD 149143 b 13.72
HD 1502 b 13.36
HD 150433 b 9.16
HD 150706 b 13.42
HD 152079 b 13.37
HD 152581 b 13.68
HD 153950 b 13.41
HD 154088 b 2.22
HD 154345 b 13.93
HD 154672 b 13.15
HD 154857 b 13.6
HD 155358 b 13.93
HD 155358 c 13.95
HD 156279 b 12.87
HD 156411 b 14
HD 156668 b 1.84
HD 157172 b 7.58
HD 158038 b 13.6
HD 159868 b 13.53
HD 159868 c 14
HD 16141 b 10.51
HD 16175 b 13.2
HD 162020 b 12.7
HD 163607 b 13.98
HD 163607 c 13.49
HD 16417 b 5.56
HD 164509 b 14.2
HD 164604 b 13.42
HD 164922 b 14.33
HD 166724 b 13.23
HD 167042 b 13.65
HD 168443 b 12.97
HD 168443 c 12.69
HD 168746 b 10.92
HD 1690 b 13.06
HD 169830 b 13.39
HD 169830 c 13.24
HD 170469 b 14.04
HD 17092 b 13.18
HD 171028 b 13.55
HD 171238 b 13.43
HD 17156 b 12.27
HD 173416 b 13.42
HD 175167 b 12.96
HD 175541 b 14.09
HD 176051 b 13.68
HD 177830 b 13.68
HD 177830 c 8.59
HD 178911 B b 13.05
HD 179079 b 6.04
HD 179949 b 13.88
HD 180314 b 12.53
HD 180902 b 13.65
HD 181342 b 13.33
HD 181433 b 2.48
HD 181433 c 14.06
HD 181433 d 14.14
HD 181720 b 14.39
HD 183263 b 13.28
HD 183263 c 13.27
HD 185269 b 13.89
HD 187085 b 13.99
HD 187123 b 14.16
HD 187123 c 13.55
HD 18742 b 13.42
HD 188015 b 13.76
HD 189567 b 3.59
HD 189733 b 12.76
HD 190360 b 13.68
HD 190360 c 5
HD 190647 b 13.57
HD 190984 b 13.36
HD 192263 b 14
HD 192310 b 4.8
HD 192310 c 5.83
HD 192699 b 13.45
HD 195019 b 13.28
HD 196050 b 13.4
HD 196067 b 13
HD 196885 A b 13.37
HD 197037 b 13.97
HD 19994 b 13.63
HD 20003 b 3.97
HD 20003 c 4.22
HD 200964 b 13.58
HD 200964 c 13.91
HD 202206 b 12.62
HD 202206 c 13.46
HD 20367 b 13.83
HD 2039 b 13.16
HD 204313 b 13.3
HD 204313 c 4.85
HD 204313 d 13.63
HD 204941 b 11.84
HD 205739 b 13.72
HD 206610 b 13.51
HD 20781 b 3.98
HD 20781 c 4.62
HD 20782 b 13.57
HD 20794 b 1.52
HD 20794 c 1.46
HD 20794 d 1.96
HD 208487 b 14.27
HD 20868 b 13.55
HD 209458 b 15.47
HD 210277 b 13.77
HD 210702 b 13.55
HD 212301 b 14.23
HD 212771 b 13.49
HD 213240 b 13.19
HD 215152 b 1.54
HD 215152 c 1.61
HD 215456 b 6.89
HD 215456 c 11.34
HD 215497 b 2.26
HD 215497 c 14.37
HD 216435 b 13.76
HD 216437 b 13.59
HD 216770 b 14.06
HD 21693 b 3.63
HD 21693 c 5.37
HD 217107 b 13.73
HD 217107 c 13.45
HD 217786 b 12.74
HD 218566 b 10.37
HD 219828 b 5.43
HD 220689 b 13.78
HD 220773 b 13.69
HD 221287 b 13.36
HD 222155 b 13.57
HD 222582 b 12.96
HD 224693 b 14.02
HD 22781 b 12.72
HD 23079 b 13.45
HD 23127 b 13.68
HD 231701 b 13.83
HD 23596 b 12.94
HD 240210 b 13.01
HD 240237 b 13.12
HD 24040 b 13.24
HD 25171 b 13.88
HD 2638 b 14.2
HD 27442 b 13.72
HD 27631 b 13.62
HD 27894 b 14.08
HD 28185 b 13.09
HD 28254 b 13.79
HD 28678 b 13.62
HD 290327 b 13.44
HD 30177 b 12.96
HD 30562 b 13.75
HD 30856 b 13.6
HD 31253 b 14.18
HD 31527 b 3.88
HD 31527 c 4.63
HD 31527 d 4.74
HD 32518 b 13.36
HD 330075 b 14.08
HD 33142 b 13.74
HD 33283 b 14.37
HD 33564 b 12.89
HD 34445 b 13.97
HD 3651 b 9.31
HD 37124 b 14.04
HD 37124 c 14.06
HD 37124 d 14.03
HD 37605 b 13.4
HD 37605 c 13.32
HD 38283 b 14.36
HD 38529 b 14.04
HD 38529 c 12.67
HD 38801 b 12.82
HD 38858 b 6.7
HD 39091 b 12.84
HD 39194 b 1.75
HD 39194 c 2.18
HD 39194 d 2.03
HD 40307 b 1.84
HD 40307 c 2.35
HD 40307 d 3.41
HD 40979 b 13.33
HD 41004 A b 13.44
HD 41004 B b 12.6
HD 4113 b 13.66
HD 4203 b 13.53
HD 4208 b 13.96
HD 4308 b 4.13
HD 4313 b 13.49
HD 43197 b 14.09
HD 43691 b 13.45
HD 44219 b 14.11
HD 45184 b 4.1
HD 45350 b 13.6
HD 45364 b 9.73
HD 45364 c 14.05
HD 45652 b 14.21
HD 46375 b 11.41
HD 47186 b 5.68
HD 47186 c 14.34
HD 47536 b 13.15
HD 47536 c 13
HD 48265 b 13.79
HD 49674 b 7.41
HD 50499 b 13.62
HD 50554 b 13.13
HD 51608 b 4.17
HD 51608 c 4.97
HD 52265 b 13.84
HD 5319 b 13.56
HD 5891 b 12.97
HD 59686 b 13.13
HD 60532 b 13.41
HD 60532 c 13.04
HD 62509 b 13.39
HD 63454 b 14.31
HD 63765 b 14.06
HD 6434 b 14.29
HD 65216 b 13.77
HD 65216 c 13.5
HD 66428 b 13.4
HD 6718 b 13.66
HD 68988 b 13.57
HD 69830 b 3.4
HD 69830 c 3.68
HD 69830 d 4.66
HD 70573 b 13.06
HD 70642 b 13.55
HD 7199 b 14.43
HD 72659 b 13.35
HD 73256 b 13.58
HD 73267 b 13.36
HD 73526 b 13.39
HD 73526 c 13.45
HD 73534 b 13.8
HD 74156 b 13.58
HD 74156 c 12.95
HD 7449 b 13.81
HD 7449 c 13.55
HD 75289 b 14.26
HD 75898 b 13.45
HD 76700 b 10.01
HD 7924 b 3.42
HD 79498 b 13.73
HD 80606 b 10.32
HD 81040 b 13.01
HD 81688 b 13.42
HD 82886 b 13.74
HD 82943 b 13.61
HD 82943 c 13.55
HD 83443 b 14.28
HD 8535 b 14.04
HD 85390 b 8
HD 85512 b 1.7
HD 8574 b 13.53
HD 86081 b 13.68
HD 86226 b 13.68
HD 86264 b 13
HD 8673 b 12.71
HD 87883 b 12.83
HD 88133 b 10.65
HD 89307 b 13.55
HD 89744 b 13.05
HD 90156 b 5
HD 92788 b 13.32
HD 93083 b 14.32
HD 93385 b 3.24
HD 93385 c 3.61
HD 9446 b 14.02
HD 9446 c 13.59
HD 95089 b 13.78
HD 9578 b 14.08
HD 96063 b 13.91
HD 96127 b 13.25
HD 96167 b 14.04
HD 96700 b 3.38
HD 96700 c 4.1
HD 97658 b 2.94
HD 98219 b 13.6
HD 98649 b 13
HD 99109 b 14.18
HD 99492 b 7.19
HD 99492 c 14.33
HD 99706 b 13.71
HIP 11952 b 13.38
HIP 11952 c 13.97
HIP 12961 b 14.35
HIP 13044 b 13.76
HIP 14810 b 13.26
HIP 14810 c 13.75
HIP 14810 d 14.12
HIP 5158 b 13.7
HIP 5158 c 12.68
HIP 57050 b 14.42
HIP 57274 b 3.86
HIP 57274 c 14.27
HIP 57274 d 14.15
HIP 70849 b 12.9
HIP 75458 b 12.97
HIP 78530 b 12.51
HIP 79431 b 13.53
HN Peg b 12.33
HR 810 b 13.5
HR 8799 b 12.33
HR 8799 c 14.57
HR 8799 d 13.45
HR 8799 e 12.9
HU Aqr(AB) c 13.08
HW Vir (AB) b 12.7
KELT-2A b 14.64
KIC 10905746 b 2.66
KIC 6185331 b 8.07
KOI-13 b 20.51
KOI-135 b 13.45
KOI-196 b 9.43
KOI-200 b 8.86
KOI-202 b 11.43
KOI-204 b 13.9
KOI-206 b 7.85
KOI-254 b 10.76
KOI-423 b 13.67
KOI-428 b 13.11
KOI-55 b 0.76
KOI-55 c 0.87
KOI-680 b 7.29
KOI-730 b 3.47
KOI-730 c 2.58
KOI-730 d 2.8
KOI-730 e 2.02
KOI-872 b 9.1
KOI-872 c 14.38
Kepler-10 b 1.42
Kepler-10 c 2.23
Kepler-11 b 1.98
Kepler-11 c 3.16
Kepler-11 d 3.44
Kepler-11 e 4.53
Kepler-11 f 2.62
Kepler-11 g 3.67
Kepler-12 b 19
Kepler-14 b 12.73
Kepler-15 b 10.76
Kepler-16 (AB) b 8.45
Kepler-17 b 14.71
Kepler-18 b 2.01
Kepler-18 c 5.49
Kepler-18 d 6.95
Kepler-19 b 2.22
Kepler-20 b 1.91
Kepler-20 c 3.03
Kepler-20 d 2.8
Kepler-20 e 0.87
Kepler-20 f 1.01
Kepler-21 b 1.64
Kepler-22 b 2.1
Kepler-23 b 1.91
Kepler-23 c 3.25
Kepler-24 b 2.35
Kepler-24 c 2.8
Kepler-25 b 2.58
Kepler-25 c 4.48
Kepler-26 b 3.59
Kepler-26 c 3.59
Kepler-27 b 4.04
Kepler-27 c 4.93
Kepler-28 b 3.59
Kepler-28 c 3.36
Kepler-29 b 3.59
Kepler-29 c 2.91
Kepler-30 b 3.7
Kepler-30 c 14.46
Kepler-30 d 10.76
Kepler-31 b 4.26
Kepler-31 c 4.26
Kepler-32 b 4.15
Kepler-32 c 3.7
Kepler-33 b 1.79
Kepler-33 c 3.25
Kepler-33 d 5.38
Kepler-33 e 4.04
Kepler-33 f 4.48
Kepler-34(AB) b 8.56
Kepler-35(AB) b 8.16
Kepler-4 b 4
Kepler-42 b 0.78
Kepler-42 c 0.73
Kepler-42 d 0.57
Kepler-5 b 16.04
Kepler-6 b 14.83
Kepler-7 b 18.09
Kepler-8 b 15.91
Kepler-9 b 9.44
Kepler-9 c 9.23
Kepler-9 d 1.65
LKCA 15 b 13.07
MOA-2007-BLG-192-L b 1.63
MOA-2007-BLG-400-L b 13.91
MOA-2008-BLG-310-L b 10.92
MOA-2009-BLG-266L b 3.66
MOA-2009-BLG-319 b 8.82
MOA-2009-BLG-387L b 13.43
MOA-2010-BLG-477L b 13.68
MOA-2011-BLG-293L b 13.47
MOA-bin-1 b 13.28
NGC 2423 3 b 12.83
NGC 4349 No 127 b 12.57
NN Ser (ab) c 13.01
NN Ser (ab) d 13.49
NY Vir b 13.49
OGLE-05-071L b 13.3
OGLE-05-169L b 4.1
OGLE-05-390L b 2.08
OGLE-06-109L b 14.07
OGLE-06-109L c 11.04
OGLE-2007-BLG-368L b 5.58
OGLE-TR-10 b 19.28
OGLE-TR-111 b 12.07
OGLE-TR-113 b 12.44
OGLE-TR-132 b 13.79
OGLE-TR-182 b 16.48
OGLE-TR-211 b 14.12
OGLE-TR-56 b 13.45
OGLE2-TR-L9 b 18.09
OGLE235-MOA53 b 13.43
Oph 11 b 12.54
PSR 1257 12 b 0.31
PSR 1257 12 c 1.72
PSR 1257 12 d 1.66
PSR 1719-14 b 4.48
PSR B1620-26 b 13.45
Qatar-1 b 13.05
Qatar-2 b 12.82
RR Cae b 13.22
Ross 458(AB) c 12.92
SR 12 AB c 12.74
SWEEPS-04 9.08
SWEEPS-11 12.67
TrES-1 12.32
TrES-2 13.1
TrES-3 14.63
TrES-4 19.12
TrES-5 13.55
UScoCTIO 108 b 12.66
UZ For(ab) d 12.96
V391 Peg b 13.34
WASP-1 b 16.63
WASP-10 b 12.11
WASP-11/HAT-P-10 b 11.71
WASP-12 b 19.46
WASP-13 b 15.3
WASP-14 b 14.36
WASP-15 b 16.01
WASP-16 b 11.3
WASP-17 b 22.32
WASP-18 b 13.06
WASP-19 b 15.54
WASP-2 b 12.09
WASP-20 b 10.09
WASP-21 b 13.56
WASP-22 b 12.98
WASP-23 b 10.78
WASP-24 b 12.37
WASP-25 b 14.12
WASP-26 b 14.36
WASP-28 b 12.55
WASP-29 b 8.88
WASP-3 b 16.3
WASP-31 b 17.23
WASP-32 b 13.23
WASP-33 b 16.12
WASP-34 b 13.67
WASP-35 b 14.8
WASP-36 b 14.22
WASP-37 b 12.73
WASP-38 b 12.09
WASP-39 b 14.24
WASP-4 b 15.28
WASP-41 b 13.56
WASP-42 b 12.11
WASP-43 b 11.61
WASP-44 b 12.78
WASP-45 b 13
WASP-46 b 14.68
WASP-47 b 12.89
WASP-48 b 18.72
WASP-49 b 12.5
WASP-5 b 13.13
WASP-50 b 12.92
WASP-52 b 14.57
WASP-53 b 13.45
WASP-54 b 15.69
WASP-55 b 14.57
WASP-56 b 13.45
WASP-57 b 12.33
WASP-58 b 14.57
WASP-59 b 10.09
WASP-6 b 13.72
WASP-60 b 10.09
WASP-61 b 13.9
WASP-62 b 15.58
WASP-63 b 16.03
WASP-64 b 7.85
WASP-65 b 14.57
WASP-66 b 15.58
WASP-67 b 15.69
WASP-68 b 10.09
WASP-69 b 11.21
WASP-7 b 14.91
WASP-70 b 8.97
WASP-78 b 19.62
WASP-79 b 19.06
WASP-8 b 11.63
WD 0806-661B b 12.95
XO-1 b 13.27
XO-2 b 10.91
XO-3 b 13.64
XO-4 b 15.02
XO-5 b 11.55
alf Ari b 13.6
beta Pic b 13.01
eps Eridani b 13.73
eps Tau b 12.97
gamma 1 Leo b 12.97
gamma Cephei b 13.65
kappa CrB b 13.6
ksi Aql b 13.4
mu Ara b 13.63
mu Ara c 3.69
mu Ara d 14.16
mu Ara e 13.59
nu Oph b 12.52
nu Oph c 12.48
tau Boo b 13.26
tau Gem b 12.61
ups And b 14.1
ups And c 12.76
ups And d 12.91
ups And e 13.83
<!DOCTYPE html>
<meta charset="utf-8">
<title>Exoplanets</title>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var color = d3.scale.quantize()
.range(["#156b87", "#876315", "#543510", "#872815"]);
var size = 960;
var pack = d3.layout.pack()
.sort(null)
.size([size, size])
.value(function(d) { return d.radius * d.radius; })
.padding(1.5);
var svg = d3.select("body").append("svg")
.attr("width", size)
.attr("height", size);
d3.csv("exoplanets.csv", function(error, exoplanets) {
exoplanets.forEach(function(d) { d.radius = +d.radius; });
color.domain(d3.extent(exoplanets, function(d) { return d.radius; }));
svg.selectAll("circle")
.data(pack.nodes({children: exoplanets}).slice(1))
.enter().append("circle")
.attr("r", function(d) { return d.r; })
.attr("cx", function(d) { return d.x; })
.attr("cy", function(d) { return d.y; })
.style("fill", function(d) { return color(d.radius); })
.append("title")
.text(function(d) { return d.name; });
});
d3.select(self.frameElement).style("height", size + "px");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment