Skip to content

Instantly share code, notes, and snippets.

@ashenfad
Last active August 29, 2015 14:05
Show Gist options
  • Save ashenfad/81e7fc0dcf28929ce47b to your computer and use it in GitHub Desktop.
Save ashenfad/81e7fc0dcf28929ce47b to your computer and use it in GitHub Desktop.
Dynamic Scatterplot - Abalone

Dynamic scatterplot of the a sample from the abalone dataset, including the top 10 anomalies found with BigML's isolation forest.

Controls:

  • Left click to choose X-axis.
  • Right click to choose Y-axis.
  • Alt + right click to choose color axis.
  • Repeat click (left, right, or alt) for log scale.
  • Hover over a point to see all field values.
  • Click a multi-point (larger circle) to cycle through values.
  • Drag box to zoom in.
  • Click on empty area to zoom out.
  • Choose plot granularity with keys 1-9 (1 is the default).
{"fields":[{"id":"000000","preferred":true,"summary":{"missing_count":0,"categories":[["Male",1528],["Infant",1342],["Female",1307]]},"datatype":"string","order":0,"term_analysis":{"enabled":true},"optype":"categorical","name":"Sex","column_number":0},{"id":"000001","preferred":true,"summary":{"splits":[0.26744,0.31595,0.34994,0.373,0.39525,0.4172,0.43605,0.45061,0.46401,0.47545,0.4889,0.50101,0.51257,0.52244,0.53138,0.54347,0.55226,0.56293,0.57193,0.57911,0.58775,0.59718,0.60571,0.61498,0.62302,0.63051,0.64062,0.65016,0.66205,0.6805,0.70805],"mean":0.52399,"sum_squares":1207.09693,"bins":[[0.075,1],[0.11,1],[0.135,5],[0.16,13],[0.18217,23],[0.20727,22],[0.23515,33],[0.25641,32],[0.27719,57],[0.29656,48],[0.32369,111],[0.35366,134],[0.37703,138],[0.39565,77],[0.41287,120],[0.43331,163],[0.45317,183],[0.47242,213],[0.49794,320],[0.52281,281],[0.54561,303],[0.57296,459],[0.59752,288],[0.62241,463],[0.64741,255],[0.66684,155],[0.68451,72],[0.70179,95],[0.72169,65],[0.74389,36],[0.77222,9],[0.8075,2]],"maximum":0.815,"missing_count":0,"variance":0.01442,"median":0.54347,"population":4177,"minimum":0.075,"standard_deviation":0.12009,"sum":2188.715},"datatype":"double","order":1,"optype":"numeric","name":"Length","column_number":1},{"id":"000002","preferred":true,"summary":{"splits":[0.19664,0.23318,0.26271,0.28026,0.30082,0.3196,0.33428,0.3478,0.35672,0.36873,0.37805,0.38738,0.39789,0.40492,0.41496,0.42358,0.43212,0.44029,0.44861,0.45398,0.46123,0.46881,0.47488,0.48124,0.48904,0.49755,0.50446,0.51368,0.5241,0.53838,0.56046],"mean":0.40788,"sum_squares":736.043,"bins":[[0.055,1],[0.10375,12],[0.12667,27],[0.14848,23],[0.1625,8],[0.17743,37],[0.19858,60],[0.2125,36],[0.22778,72],[0.24849,86],[0.26289,64],[0.27685,138],[0.29158,57],[0.30663,150],[0.32775,171],[0.34853,245],[0.36252,105],[0.37772,276],[0.40029,360],[0.42277,296],[0.43765,164],[0.45279,376],[0.47282,392],[0.48744,162],[0.50224,321],[0.5219,240],[0.54445,155],[0.57018,114],[0.5969,21],[0.6125,2],[0.627,5],[0.65,1]],"maximum":0.65,"missing_count":0,"variance":0.00985,"median":0.42358,"population":4177,"minimum":0.055,"standard_deviation":0.09924,"sum":1703.72},"datatype":"double","order":2,"optype":"numeric","name":"Diameter","column_number":2},{"id":"000003","preferred":true,"summary":{"splits":[0.06421,0.07715,0.08593,0.09196,0.09819,0.10301,0.10841,0.1133,0.11797,0.12185,0.12524,0.1287,0.13246,0.13596,0.13915,0.14221,0.14562,0.14861,0.15114,0.15384,0.15683,0.15996,0.1632,0.1666,0.17044,0.17401,0.17734,0.18197,0.18805,0.195,0.20511],"mean":0.13952,"sum_squares":88.6105,"bins":[[0,2],[0.01333,3],[0.02,2],[0.02773,11],[0.03842,19],[0.045,11],[0.05291,43],[0.063,65],[0.07282,108],[0.08,76],[0.08813,198],[0.095,91],[0.1022,259],[0.11,135],[0.1178,302],[0.12728,371],[0.135,189],[0.14226,402],[0.15224,484],[0.16242,398],[0.17284,371],[0.1822,234],[0.19215,181],[0.20199,113],[0.21287,54],[0.22,17],[0.225,13],[0.23188,16],[0.24,4],[0.25,3],[0.515,1],[1.13,1]],"maximum":1.13,"missing_count":0,"variance":0.00175,"median":0.14221,"population":4177,"minimum":0,"standard_deviation":0.04183,"sum":582.76},"datatype":"double","order":3,"optype":"numeric","name":"Height","column_number":3},{"id":"000004","preferred":true,"summary":{"splits":[0.09251,0.14798,0.19806,0.23933,0.29343,0.34605,0.39306,0.44197,0.48059,0.52362,0.57414,0.61118,0.65507,0.70461,0.75719,0.79937,0.84119,0.87742,0.92332,0.97035,1.01395,1.06294,1.11091,1.15327,1.20759,1.26197,1.32598,1.3945,1.50121,1.6242,1.81723],"mean":0.82874,"sum_squares":3873.07055,"bins":[[0.04945,123],[0.12626,175],[0.20518,236],[0.29219,232],[0.36513,138],[0.44922,343],[0.55777,306],[0.6467,236],[0.71832,147],[0.79869,303],[0.8906,279],[0.96804,182],[1.04208,230],[1.11762,192],[1.19914,244],[1.27366,109],[1.34724,182],[1.44925,131],[1.53873,81],[1.63306,99],[1.73975,55],[1.81496,42],[1.89129,17],[1.97294,26],[2.06956,17],[2.16114,22],[2.24527,11],[2.32225,4],[2.38667,3],[2.52217,9],[2.657,1],[2.8025,2]],"maximum":2.8255,"missing_count":0,"variance":0.24048,"median":0.79937,"population":4177,"minimum":0.002,"standard_deviation":0.49039,"sum":3461.656},"datatype":"double","order":4,"optype":"numeric","name":"Whole Weight","column_number":4},{"id":"000005","preferred":true,"summary":{"splits":[0.03684,0.06094,0.08187,0.10148,0.12381,0.14896,0.16666,0.18606,0.20328,0.22057,0.24066,0.25841,0.27789,0.29649,0.31538,0.33596,0.35461,0.37513,0.39467,0.41711,0.43736,0.46032,0.48241,0.50215,0.52724,0.55306,0.58425,0.61674,0.65736,0.71123,0.8179],"mean":0.35937,"sum_squares":745.17992,"bins":[[0.03657,278],[0.084,251],[0.11599,150],[0.1561,325],[0.20319,339],[0.24748,285],[0.29321,350],[0.34099,291],[0.37914,215],[0.41097,179],[0.44772,272],[0.48686,197],[0.52774,268],[0.57603,175],[0.61245,130],[0.65469,144],[0.69949,82],[0.73711,59],[0.77256,33],[0.81383,39],[0.85046,14],[0.88248,25],[0.91919,16],[0.95096,12],[1.00511,14],[1.06823,11],[1.10938,4],[1.14225,8],[1.18717,3],[1.2419,5],[1.34975,2],[1.488,1]],"maximum":1.488,"missing_count":0,"variance":0.04927,"median":0.33596,"population":4177,"minimum":0.001,"standard_deviation":0.22196,"sum":1501.078},"datatype":"double","order":5,"optype":"numeric","name":"Shucked Weight","column_number":5},{"id":"000006","preferred":true,"summary":{"splits":[0.01944,0.03235,0.04109,0.05188,0.06124,0.07228,0.08293,0.09318,0.1032,0.11242,0.1234,0.13267,0.14206,0.1516,0.16078,0.17059,0.17967,0.18984,0.19901,0.20908,0.21945,0.22931,0.24036,0.25295,0.2647,0.27896,0.29568,0.30941,0.33172,0.36516,0.40775],"mean":0.18059,"sum_squares":186.40472,"bins":[[0.01435,185],[0.03986,365],[0.06125,201],[0.07709,182],[0.09087,165],[0.10531,218],[0.1207,182],[0.13776,274],[0.15638,242],[0.17606,314],[0.19996,321],[0.2209,227],[0.23948,225],[0.25896,195],[0.27768,168],[0.29923,194],[0.31859,115],[0.33627,64],[0.35711,99],[0.38149,77],[0.40429,50],[0.42242,30],[0.4452,30],[0.46917,12],[0.48474,17],[0.4995,2],[0.51857,14],[0.544,3],[0.57117,3],[0.59,1],[0.6415,1],[0.76,1]],"maximum":0.76,"missing_count":0,"variance":0.01202,"median":0.17059,"population":4177,"minimum":5.0E-4,"standard_deviation":0.10961,"sum":754.3395},"datatype":"double","order":6,"optype":"numeric","name":"Viscera Weight","column_number":6},{"id":"000007","preferred":true,"summary":{"splits":[0.02902,0.04488,0.0611,0.07502,0.08823,0.10284,0.11661,0.12997,0.14233,0.15469,0.16842,0.17928,0.19069,0.20531,0.2192,0.23367,0.24437,0.25465,0.26611,0.27708,0.28943,0.30186,0.31478,0.3285,0.34361,0.35688,0.37543,0.39932,0.42715,0.46503,0.51599],"mean":0.23883,"sum_squares":319.17678,"bins":[[0.00971,70],[0.03818,279],[0.07059,261],[0.09257,167],[0.11503,250],[0.14526,358],[0.18219,421],[0.21745,276],[0.24967,407],[0.28447,389],[0.31443,247],[0.34648,339],[0.37949,153],[0.40279,119],[0.42309,72],[0.44429,88],[0.46788,60],[0.49058,69],[0.51302,32],[0.53514,29],[0.56294,17],[0.58791,27],[0.61888,12],[0.64958,13],[0.68142,6],[0.71729,7],[0.76,1],[0.78875,2],[0.815,1],[0.85,1],[0.889,3],[1.005,1]],"maximum":1.005,"missing_count":0,"variance":0.01938,"median":0.23367,"population":4177,"minimum":0.0015,"standard_deviation":0.1392,"sum":997.5965},"datatype":"double","order":7,"optype":"numeric","name":"Shell Weight","column_number":7},{"id":"000008","preferred":true,"summary":{"counts":[[1,1],[2,1],[3,15],[4,57],[5,115],[6,259],[7,391],[8,568],[9,689],[10,634],[11,487],[12,267],[13,203],[14,126],[15,103],[16,67],[17,58],[18,42],[19,32],[20,26],[21,14],[22,6],[23,9],[24,2],[25,1],[26,1],[27,2],[29,1]],"mean":9.93368,"sum_squares":455589,"maximum":29,"missing_count":0,"variance":10.39527,"median":9.49906,"population":4177,"minimum":1,"standard_deviation":3.22417,"sum":41493},"datatype":"int8","order":8,"optype":"numeric","name":"Rings (~Age)","column_number":8},{"name":"Anomaly score","optype":"numeric"}],"rows":[["Female",0.78,0.63,0.215,2.657,1.488,0.4985,0.586,11.0,0.84179],["Male",0.775,0.63,0.25,2.7795,1.3485,0.76,0.578,12.0,0.88968],["Infant",0.075,0.055,0.01,0.002,0.001,5.0E-4,0.0015,1.0,0.89227],["Female",0.455,0.355,1.13,0.594,0.332,0.116,0.1335,8.0,0.83655],["Male",0.77,0.62,0.195,2.5155,1.1155,0.6415,0.642,12.0,0.82928],["Male",0.665,0.535,0.225,2.1835,0.7535,0.391,0.885,27.0,0.8369],["Male",0.73,0.595,0.23,2.8255,1.1465,0.419,0.897,17.0,0.84389],["Female",0.815,0.65,0.25,2.255,0.8905,0.42,0.7975,14.0,0.87028],["Male",0.705,0.565,0.515,2.21,1.1075,0.4865,0.512,10.0,0.82824],["Female",0.8,0.63,0.195,2.526,0.933,0.59,0.62,23.0,0.84847],["Male",0.625,0.475,0.175,1.3405,0.656,0.283,0.337,10.0,0.41954],["Male",0.63,0.525,0.195,1.3135,0.4935,0.2565,0.465,10.0,0.48691],["Female",0.48,0.37,0.13,0.5885,0.2475,0.1505,0.1595,15.0,0.4863],["Male",0.495,0.415,0.165,0.7485,0.264,0.134,0.285,13.0,0.49942],["Female",0.635,0.505,0.155,1.2895,0.594,0.314,0.345,11.0,0.40716],["Female",0.705,0.55,0.2,1.7095,0.633,0.4115,0.49,13.0,0.50171],["Infant",0.375,0.28,0.08,0.226,0.105,0.047,0.065,6.0,0.4001],["Male",0.645,0.5,0.16,1.3815,0.672,0.326,0.315,9.0,0.45518],["Male",0.67,0.54,0.195,1.217,0.532,0.2735,0.3315,11.0,0.49467],["Female",0.565,0.45,0.175,1.2365,0.5305,0.2455,0.308,10.0,0.4423],["Female",0.59,0.44,0.14,1.007,0.4775,0.2105,0.2925,9.0,0.41451],["Infant",0.575,0.45,0.135,0.8715,0.45,0.162,0.225,10.0,0.4586],["Infant",0.61,0.475,0.17,1.0385,0.4435,0.241,0.32,14.0,0.48833],["Female",0.49,0.355,0.16,0.8795,0.3485,0.215,0.2825,8.0,0.58764],["Male",0.31,0.225,0.08,0.1345,0.054,0.024,0.05,7.0,0.51397],["Male",0.445,0.34,0.12,0.4475,0.193,0.1035,0.13,9.0,0.43157],["Male",0.515,0.425,0.145,0.9365,0.497,0.181,0.2185,8.0,0.50865],["Female",0.595,0.46,0.16,0.921,0.4005,0.2025,0.2875,9.0,0.37637],["Infant",0.375,0.275,0.095,0.2465,0.11,0.0415,0.0775,6.0,0.41107],["Female",0.44,0.345,0.105,0.4285,0.165,0.083,0.132,11.0,0.47019],["Male",0.43,0.335,0.12,0.397,0.1985,0.0865,0.1035,7.0,0.47491],["Male",0.575,0.425,0.14,0.8635,0.393,0.227,0.2,11.0,0.45669],["Female",0.52,0.415,0.145,0.8045,0.3325,0.1725,0.285,10.0,0.43014],["Infant",0.45,0.335,0.11,0.4195,0.181,0.085,0.1345,7.0,0.40144],["Female",0.665,0.535,0.19,1.496,0.5775,0.2815,0.475,17.0,0.49611],["Female",0.55,0.445,0.155,0.9905,0.544,0.178,0.218,9.0,0.47176],["Male",0.28,0.21,0.065,0.0905,0.035,0.02,0.03,5.0,0.53602],["Female",0.66,0.475,0.18,1.3695,0.641,0.294,0.335,6.0,0.62288],["Infant",0.525,0.4,0.13,0.6455,0.325,0.1245,0.17,8.0,0.42058],["Male",0.4,0.3,0.125,0.417,0.191,0.09,0.1175,9.0,0.52652],["Female",0.57,0.45,0.15,0.9645,0.531,0.189,0.209,9.0,0.46281],["Male",0.54,0.435,0.14,0.7345,0.33,0.1595,0.213,9.0,0.39894],["Infant",0.425,0.31,0.105,0.365,0.159,0.0825,0.105,6.0,0.42076],["Male",0.56,0.45,0.155,0.9125,0.3595,0.271,0.35,10.0,0.47808],["Female",0.545,0.415,0.16,0.7715,0.272,0.1455,0.2765,10.0,0.44544],["Female",0.63,0.48,0.15,1.0525,0.392,0.336,0.285,12.0,0.52455],["Female",0.58,0.435,0.155,0.8785,0.425,0.1685,0.2425,10.0,0.40513],["Male",0.655,0.53,0.175,1.2635,0.486,0.2635,0.415,15.0,0.47215],["Female",0.61,0.5,0.18,1.438,0.5185,0.3735,0.3345,9.0,0.49016],["Male",0.45,0.355,0.115,0.479,0.2125,0.1045,0.15,8.0,0.42006],["Infant",0.345,0.255,0.095,0.1945,0.0925,0.037,0.055,6.0,0.43409],["Infant",0.275,0.22,0.08,0.1365,0.0565,0.0285,0.042,6.0,0.46649],["Infant",0.36,0.275,0.085,0.1975,0.0745,0.0415,0.07,9.0,0.45612],["Infant",0.52,0.41,0.14,0.6625,0.2775,0.1555,0.196,11.0,0.42339],["Infant",0.365,0.295,0.095,0.25,0.1075,0.0545,0.08,9.0,0.44303],["Infant",0.42,0.315,0.1,0.3435,0.157,0.0795,0.09,6.0,0.42129],["Male",0.46,0.36,0.135,0.6105,0.1955,0.107,0.235,14.0,0.5414],["Infant",0.54,0.425,0.135,0.686,0.3475,0.1545,0.213,8.0,0.43301],["Female",0.63,0.5,0.175,1.1105,0.467,0.268,0.329,10.0,0.39367],["Male",0.63,0.515,0.16,1.016,0.4215,0.244,0.355,19.0,0.53003],["Male",0.68,0.515,0.16,1.2345,0.618,0.2625,0.325,11.0,0.47867],["Female",0.57,0.495,0.16,1.0915,0.452,0.275,0.315,14.0,0.45879],["Male",0.59,0.47,0.18,1.187,0.5985,0.227,0.31,9.0,0.42287],["Male",0.485,0.385,0.105,0.556,0.296,0.104,0.133,7.0,0.50109],["Male",0.54,0.415,0.13,0.8245,0.272,0.226,0.24,13.0,0.48247],["Female",0.65,0.51,0.155,1.189,0.483,0.278,0.3645,13.0,0.43973],["Infant",0.585,0.47,0.17,0.985,0.3695,0.2395,0.315,10.0,0.48975],["Male",0.465,0.375,0.11,0.5,0.21,0.113,0.1505,8.0,0.43572],["Infant",0.395,0.32,0.1,0.3075,0.149,0.0535,0.09,8.0,0.44377],["Male",0.59,0.465,0.155,1.136,0.5245,0.2615,0.275,11.0,0.39367],["Female",0.56,0.42,0.18,1.6645,0.7755,0.35,0.4525,9.0,0.64369],["Male",0.545,0.46,0.16,0.8975,0.341,0.1655,0.345,10.0,0.45329],["Female",0.725,0.56,0.185,1.792,0.873,0.367,0.435,11.0,0.50046],["Male",0.55,0.43,0.13,0.8395,0.3155,0.1955,0.2405,10.0,0.40177],["Infant",0.475,0.385,0.11,0.5735,0.311,0.1025,0.136,7.0,0.48287],["Female",0.615,0.48,0.165,1.1615,0.513,0.301,0.305,10.0,0.38316],["Infant",0.46,0.355,0.11,0.436,0.1975,0.096,0.125,8.0,0.37763],["Female",0.56,0.445,0.155,1.224,0.5565,0.3225,0.2695,10.0,0.51826],["Male",0.505,0.385,0.145,0.6775,0.236,0.179,0.2,15.0,0.48007],["Female",0.64,0.475,0.19,1.151,0.4365,0.281,0.3805,13.0,0.45593],["Male",0.565,0.455,0.15,0.9595,0.4565,0.2395,0.23,9.0,0.39994],["Female",0.635,0.485,0.165,1.2695,0.5635,0.3065,0.3395,11.0,0.39481],["Infant",0.57,0.44,0.13,0.7665,0.347,0.1785,0.202,10.0,0.44414],["Infant",0.405,0.3,0.09,0.269,0.103,0.067,0.11,6.0,0.48874],["Male",0.65,0.515,0.18,1.463,0.658,0.3135,0.4115,11.0,0.39795],["Infant",0.525,0.4,0.14,0.654,0.305,0.16,0.169,7.0,0.46262],["Female",0.525,0.4,0.135,0.714,0.318,0.138,0.208,10.0,0.42322],["Female",0.505,0.39,0.16,0.644,0.2475,0.2025,0.1635,9.0,0.52893],["Male",0.6,0.47,0.165,1.059,0.504,0.241,0.275,9.0,0.36345],["Infant",0.3,0.215,0.05,0.1185,0.048,0.0225,0.042,4.0,0.55879],["Infant",0.545,0.43,0.15,0.742,0.3525,0.158,0.208,10.0,0.41745],["Male",0.565,0.435,0.185,0.9815,0.329,0.136,0.39,13.0,0.54388],["Infant",0.555,0.43,0.15,0.783,0.345,0.1755,0.247,9.0,0.40378],["Male",0.57,0.455,0.155,0.832,0.3585,0.174,0.277,11.0,0.3958],["Infant",0.485,0.37,0.115,0.637,0.38,0.1335,0.128,7.0,0.54729],["Female",0.695,0.535,0.175,1.361,0.5465,0.2815,0.465,10.0,0.50527],["Female",0.525,0.4,0.13,0.6995,0.3115,0.131,0.223,9.0,0.44451],["Infant",0.65,0.525,0.18,1.626,0.597,0.3445,0.53,18.0,0.63729],["Infant",0.3,0.225,0.075,0.1345,0.057,0.028,0.044,5.0,0.44711],["Infant",0.575,0.445,0.16,0.9175,0.45,0.1935,0.24,9.0,0.44785],["Male",0.59,0.485,0.12,0.911,0.39,0.182,0.29,16.0,0.53313],["Female",0.665,0.505,0.165,1.349,0.5985,0.3175,0.36,9.0,0.42658],["Female",0.68,0.55,0.19,1.807,0.8225,0.3655,0.515,11.0,0.48772],["Male",0.59,0.465,0.14,1.046,0.4695,0.263,0.263,7.0,0.48935],["Female",0.56,0.45,0.16,1.0235,0.429,0.268,0.3,10.0,0.42357],["Male",0.425,0.325,0.1,0.3295,0.1365,0.0725,0.11,7.0,0.4698],["Infant",0.33,0.255,0.085,0.1655,0.063,0.039,0.06,8.0,0.44396],["Infant",0.295,0.225,0.08,0.124,0.0485,0.032,0.04,9.0,0.51891],["Female",0.5,0.375,0.14,0.604,0.242,0.1415,0.179,15.0,0.46128],["Infant",0.315,0.24,0.085,0.1715,0.071,0.0345,0.0535,7.0,0.44599],["Female",0.615,0.47,0.155,1.084,0.5885,0.209,0.246,9.0,0.43068],["Male",0.6,0.46,0.155,0.6655,0.285,0.149,0.269,11.0,0.54388],["Female",0.61,0.495,0.185,1.153,0.536,0.2905,0.245,8.0,0.49549],["Male",0.64,0.49,0.14,1.194,0.4445,0.238,0.375,15.0,0.50443],["Female",0.635,0.51,0.175,1.2125,0.5735,0.261,0.36,14.0,0.41814],["Male",0.175,0.135,0.04,0.0305,0.011,0.0075,0.01,5.0,0.61643],["Infant",0.275,0.215,0.075,0.1155,0.0485,0.029,0.035,7.0,0.45159],["Male",0.675,0.525,0.175,1.402,0.483,0.3205,0.465,16.0,0.50443],["Female",0.535,0.45,0.135,0.8075,0.322,0.181,0.25,13.0,0.44525],["Female",0.62,0.51,0.18,1.3315,0.594,0.276,0.388,11.0,0.40479],["Male",0.41,0.3,0.1,0.301,0.124,0.069,0.09,9.0,0.47451],["Infant",0.575,0.44,0.15,0.983,0.486,0.215,0.239,8.0,0.49694],["Infant",0.46,0.35,0.11,0.4,0.176,0.083,0.1205,7.0,0.39383],["Female",0.645,0.49,0.19,1.3065,0.479,0.3565,0.345,18.0,0.53158],["Male",0.58,0.45,0.12,0.8685,0.418,0.1475,0.2605,8.0,0.49426],["Female",0.49,0.38,0.13,0.539,0.229,0.1355,0.165,12.0,0.43572],["Female",0.575,0.45,0.12,0.9585,0.447,0.169,0.275,12.0,0.48007],["Female",0.675,0.57,0.225,1.587,0.739,0.2995,0.435,10.0,0.57411],["Female",0.39,0.29,0.125,0.3055,0.121,0.082,0.09,7.0,0.53669],["Female",0.58,0.455,0.12,0.94,0.399,0.257,0.265,11.0,0.48227],["Infant",0.16,0.11,0.025,0.0195,0.0075,0.005,0.006,4.0,0.60249],["Female",0.495,0.4,0.155,0.6445,0.242,0.1325,0.205,17.0,0.50844],["Female",0.485,0.375,0.145,0.5885,0.2385,0.1155,0.19,13.0,0.44953],["Infant",0.39,0.29,0.1,0.2845,0.1255,0.0635,0.081,7.0,0.3846],["Infant",0.16,0.12,0.035,0.021,0.0075,0.0045,0.005,5.0,0.5869],["Female",0.405,0.305,0.095,0.3485,0.1455,0.0895,0.1,9.0,0.50485],["Female",0.64,0.54,0.175,1.221,0.51,0.259,0.39,15.0,0.49487],["Female",0.46,0.36,0.115,0.4755,0.2105,0.105,0.16,8.0,0.43881],["Female",0.545,0.4,0.14,0.778,0.368,0.215,0.18,9.0,0.47907],["Female",0.585,0.455,0.165,0.998,0.345,0.2495,0.315,12.0,0.41296],["Male",0.32,0.245,0.075,0.1555,0.0585,0.038,0.049,11.0,0.56722],["Infant",0.375,0.3,0.075,0.144,0.059,0.03,0.044,7.0,0.55624],["Female",0.595,0.5,0.18,1.053,0.4405,0.192,0.39,13.0,0.48047],["Infant",0.305,0.23,0.075,0.1455,0.0595,0.0305,0.05,6.0,0.42711],["Male",0.515,0.385,0.11,0.5785,0.253,0.16,0.14,8.0,0.49118],["Male",0.5,0.365,0.13,0.5945,0.309,0.1085,0.1535,9.0,0.45898],["Infant",0.53,0.425,0.13,0.781,0.3905,0.2005,0.215,9.0,0.46532],["Female",0.645,0.52,0.17,1.197,0.526,0.2925,0.317,11.0,0.42925],["Infant",0.49,0.4,0.135,0.624,0.3035,0.1285,0.169,8.0,0.42516],["Infant",0.31,0.24,0.105,0.2885,0.118,0.065,0.083,6.0,0.57006],["Infant",0.455,0.375,0.12,0.497,0.2355,0.1055,0.1295,6.0,0.44414],["Male",0.645,0.495,0.185,1.4935,0.5265,0.2785,0.455,15.0,0.47907],["Infant",0.505,0.4,0.145,0.7045,0.334,0.1425,0.207,8.0,0.44934],["Female",0.57,0.455,0.165,1.0595,0.44,0.2195,0.285,14.0,0.41936],["Male",0.625,0.52,0.175,1.4105,0.691,0.322,0.3465,10.0,0.45537],["Infant",0.52,0.4,0.13,0.5825,0.233,0.1365,0.18,10.0,0.40412],["Infant",0.415,0.315,0.105,0.33,0.1405,0.0705,0.095,6.0,0.41693],["Male",0.585,0.465,0.19,1.171,0.3905,0.2355,0.4,17.0,0.48509],["Female",0.58,0.48,0.18,1.2495,0.4945,0.27,0.371,8.0,0.46301],["Female",0.58,0.44,0.18,0.854,0.3665,0.1635,0.245,12.0,0.44711],["Male",0.315,0.25,0.09,0.203,0.0615,0.037,0.0795,11.0,0.58301],["Infant",0.42,0.31,0.1,0.2865,0.115,0.0735,0.085,8.0,0.43283],["Female",0.615,0.5,0.165,1.327,0.6,0.3015,0.355,10.0,0.3883],["Infant",0.45,0.36,0.13,0.478,0.191,0.127,0.137,7.0,0.44433],["Female",0.68,0.56,0.165,1.639,0.6055,0.2805,0.46,15.0,0.53826],["Male",0.64,0.5,0.185,1.3035,0.4445,0.2635,0.465,16.0,0.47392],["Female",0.755,0.625,0.21,2.505,1.1965,0.513,0.6785,11.0,0.76149],["Male",0.59,0.44,0.15,0.9555,0.366,0.2425,0.295,11.0,0.41073],["Male",0.72,0.575,0.23,2.2695,0.8835,0.3985,0.665,16.0,0.66824],["Male",0.68,0.52,0.165,1.4775,0.724,0.279,0.406,11.0,0.4548],["Infant",0.37,0.275,0.1,0.2295,0.0885,0.0465,0.07,7.0,0.38798],["Male",0.455,0.345,0.15,0.5795,0.1685,0.125,0.215,13.0,0.5574],["Male",0.52,0.425,0.125,0.79,0.372,0.205,0.19,8.0,0.47136],["Infant",0.32,0.25,0.08,0.1565,0.057,0.034,0.06,9.0,0.48914],["Infant",0.43,0.325,0.09,0.425,0.217,0.087,0.095,7.0,0.49528],["Male",0.625,0.5,0.175,1.0565,0.4615,0.258,0.305,10.0,0.39481],["Infant",0.515,0.4,0.135,0.636,0.3055,0.1215,0.1855,9.0,0.39828],["Female",0.68,0.52,0.185,1.541,0.5985,0.395,0.4575,10.0,0.46921],["Female",0.695,0.535,0.175,1.8385,0.8035,0.396,0.503,10.0,0.50612],["Infant",0.61,0.46,0.17,1.278,0.41,0.257,0.37,17.0,0.56888],["Female",0.495,0.385,0.13,0.6905,0.3125,0.179,0.175,10.0,0.46166],["Infant",0.51,0.405,0.125,0.6795,0.3465,0.1395,0.182,8.0,0.43809],["Female",0.38,0.32,0.115,0.6475,0.323,0.1325,0.164,7.0,0.60828],["Female",0.545,0.43,0.165,0.802,0.2935,0.183,0.28,11.0,0.42234],["Male",0.5,0.39,0.13,0.709,0.275,0.168,0.18,11.0,0.43627],["Infant",0.355,0.27,0.075,0.1775,0.079,0.0315,0.054,6.0,0.45103],["Male",0.62,0.465,0.145,0.911,0.375,0.2145,0.278,10.0,0.42234],["Female",0.61,0.43,0.14,0.909,0.438,0.2,0.22,8.0,0.4661],["Infant",0.365,0.27,0.085,0.196,0.0825,0.0375,0.06,7.0,0.39795],["Male",0.325,0.24,0.075,0.155,0.0475,0.0355,0.06,9.0,0.53246],["Female",0.565,0.44,0.135,0.83,0.393,0.1735,0.238,9.0,0.38911],["Infant",0.53,0.42,0.185,0.752,0.299,0.156,0.205,20.0,0.63703],["Infant",0.54,0.42,0.14,0.7265,0.3205,0.1445,0.229,9.0,0.39138],["Female",0.635,0.49,0.17,1.2615,0.5385,0.2665,0.38,9.0,0.38975],["Male",0.565,0.445,0.145,0.9255,0.4345,0.212,0.2475,9.0,0.37232],["Male",0.6,0.475,0.155,1.1385,0.502,0.2295,0.31,9.0,0.36058],["Infant",0.325,0.245,0.075,0.1495,0.0605,0.033,0.045,5.0,0.43409],["Female",0.62,0.47,0.14,1.0325,0.3605,0.224,0.36,15.0,0.49057],["Male",0.52,0.39,0.12,0.6435,0.2885,0.157,0.161,7.0,0.44972],["Male",0.66,0.51,0.165,1.6375,0.7685,0.3545,0.3925,14.0,0.52216],["Infant",0.475,0.35,0.115,0.498,0.2375,0.099,0.14,7.0,0.40631],["Infant",0.355,0.28,0.085,0.2905,0.095,0.0395,0.115,7.0,0.52893],["Female",0.6,0.485,0.165,1.1405,0.587,0.2175,0.288,9.0,0.40345],["Infant",0.42,0.305,0.11,0.28,0.094,0.0785,0.0955,9.0,0.4861],["Male",0.505,0.39,0.12,0.653,0.3315,0.1385,0.167,9.0,0.43355],["Infant",0.565,0.44,0.175,0.8735,0.414,0.21,0.21,11.0,0.49179],["Female",0.64,0.505,0.19,1.2765,0.4835,0.328,0.4,12.0,0.43609],["Male",0.44,0.34,0.105,0.402,0.1305,0.0955,0.165,10.0,0.50696],["Male",0.58,0.45,0.16,0.8675,0.3935,0.221,0.215,9.0,0.43068],["Male",0.635,0.49,0.16,1.101,0.534,0.1865,0.3455,10.0,0.45103],["Female",0.655,0.515,0.17,1.527,0.8485,0.2635,0.331,11.0,0.53624],["Male",0.63,0.51,0.19,1.4985,0.4125,0.3075,0.545,16.0,0.56159],["Male",0.265,0.2,0.065,0.084,0.034,0.0105,0.03,7.0,0.5777],["Female",0.66,0.53,0.185,1.346,0.546,0.2705,0.476,11.0,0.45009],["Infant",0.555,0.46,0.145,0.9005,0.3845,0.158,0.2765,11.0,0.46843],["Infant",0.4,0.31,0.1,0.2875,0.1145,0.0635,0.095,10.0,0.45009],["Infant",0.475,0.36,0.11,0.492,0.211,0.11,0.15,8.0,0.37512],["Male",0.63,0.49,0.155,1.229,0.535,0.29,0.335,11.0,0.38572],["Female",0.585,0.46,0.165,1.058,0.486,0.25,0.294,9.0,0.37668],["Female",0.67,0.55,0.19,1.3905,0.5425,0.3035,0.4,12.0,0.46629],["Infant",0.465,0.355,0.105,0.442,0.2085,0.0975,0.1185,7.0,0.40395],["Infant",0.37,0.28,0.085,0.217,0.1095,0.035,0.062,6.0,0.42853],["Male",0.59,0.455,0.155,0.8855,0.388,0.188,0.275,10.0,0.39024],["Male",0.66,0.525,0.18,1.478,0.5815,0.381,0.372,10.0,0.45009],["Male",0.67,0.52,0.165,1.39,0.711,0.2865,0.3,11.0,0.47451],["Infant",0.495,0.38,0.145,0.515,0.175,0.098,0.212,13.0,0.51826],["Infant",0.45,0.35,0.13,0.547,0.245,0.1405,0.1405,8.0,0.45955],["Male",0.575,0.475,0.16,1.114,0.4955,0.2745,0.29,9.0,0.39811],["Female",0.605,0.475,0.175,1.382,0.609,0.2325,0.3985,10.0,0.47333],["Male",0.52,0.395,0.125,0.8115,0.4035,0.166,0.2,7.0,0.4988],["Infant",0.52,0.38,0.115,0.6645,0.3285,0.17,0.1425,7.0,0.54479],["Male",0.615,0.45,0.15,1.198,0.707,0.2095,0.2505,7.0,0.56416],["Male",0.645,0.515,0.24,1.5415,0.471,0.369,0.535,13.0,0.66436],["Infant",0.485,0.355,0.105,0.498,0.2175,0.096,0.1525,9.0,0.42835],["Female",0.55,0.43,0.15,0.84,0.395,0.195,0.223,8.0,0.38717],["Infant",0.61,0.465,0.125,0.9225,0.436,0.19,0.26,9.0,0.50339],["Male",0.605,0.49,0.145,1.3,0.517,0.3285,0.31,14.0,0.51375],["Infant",0.44,0.345,0.13,0.4495,0.209,0.0835,0.134,6.0,0.4698],["Male",0.7,0.535,0.16,1.7255,0.63,0.2635,0.54,19.0,0.62547],["Male",0.58,0.47,0.165,0.927,0.3215,0.1985,0.315,11.0,0.42569],["Male",0.57,0.455,0.175,1.02,0.4805,0.2145,0.29,9.0,0.40211],["Male",0.55,0.405,0.14,0.8025,0.244,0.1635,0.255,10.0,0.45499],["Female",0.6,0.475,0.16,1.0265,0.485,0.2495,0.2565,9.0,0.38348],["Male",0.525,0.425,0.125,0.812,0.4035,0.1705,0.195,8.0,0.44599],["Male",0.285,0.21,0.075,0.1185,0.055,0.0285,0.04,7.0,0.51761],["Male",0.63,0.49,0.16,1.09,0.407,0.224,0.354,12.0,0.41866],["Female",0.525,0.43,0.135,0.8435,0.4325,0.18,0.1815,9.0,0.47136],["Male",0.575,0.455,0.165,0.867,0.3765,0.1805,0.268,8.0,0.42711],["Male",0.7,0.565,0.175,1.8565,0.8445,0.3935,0.54,10.0,0.53446],["Infant",0.48,0.35,0.135,0.5465,0.2735,0.0995,0.158,8.0,0.44692],["Male",0.63,0.47,0.145,1.1005,0.52,0.26,0.276,9.0,0.41278],["Male",0.61,0.475,0.155,1.168,0.554,0.239,0.3295,10.0,0.37418],["Infant",0.225,0.17,0.07,0.0565,0.024,0.013,0.016,4.0,0.53202],["Female",0.545,0.41,0.125,0.654,0.2945,0.1315,0.205,10.0,0.45385],["Female",0.55,0.38,0.165,1.205,0.543,0.294,0.3345,10.0,0.57101],["Infant",0.535,0.4,0.135,0.6025,0.2895,0.121,0.154,9.0,0.4434],["Infant",0.48,0.355,0.11,0.4495,0.201,0.089,0.14,8.0,0.3904],["Female",0.49,0.375,0.15,0.5755,0.22,0.144,0.19,9.0,0.4548],["Female",0.48,0.39,0.125,0.6905,0.219,0.155,0.2,12.0,0.47136],["Infant",0.47,0.37,0.14,0.4985,0.2095,0.1225,0.145,10.0,0.42234],["Infant",0.505,0.405,0.13,0.6015,0.3015,0.11,0.18,8.0,0.4296],["Female",0.63,0.505,0.165,1.065,0.4595,0.216,0.315,12.0,0.43409],["Infant",0.315,0.23,0.08,0.1375,0.0545,0.031,0.0445,5.0,0.43699],["Male",0.545,0.39,0.135,0.7835,0.4225,0.1815,0.156,7.0,0.52433],["Infant",0.42,0.3,0.105,0.316,0.1255,0.07,0.1035,7.0,0.42942],["Male",0.575,0.455,0.135,0.907,0.4245,0.197,0.26,9.0,0.39597],["Female",0.58,0.45,0.235,1.071,0.3,0.206,0.395,14.0,0.62808],["Infant",0.52,0.38,0.125,0.5545,0.288,0.1295,0.167,8.0,0.40144],["Infant",0.455,0.35,0.135,0.5365,0.2855,0.0855,0.1325,7.0,0.48874],["Infant",0.52,0.415,0.14,0.6375,0.308,0.1335,0.168,9.0,0.42853],["Infant",0.35,0.25,0.1,0.4015,0.1725,0.063,0.1255,7.0,0.58253],["Male",0.245,0.18,0.065,0.0635,0.0245,0.0135,0.02,4.0,0.57842],["Infant",0.485,0.365,0.14,0.4475,0.1895,0.0925,0.2305,8.0,0.52893],["Male",0.59,0.46,0.155,0.906,0.327,0.1485,0.335,15.0,0.48267],["Female",0.605,0.455,0.145,0.9775,0.468,0.1775,0.275,9.0,0.41399],["Male",0.485,0.355,0.12,0.547,0.215,0.1615,0.14,10.0,0.48813],["Infant",0.215,0.17,0.055,0.0605,0.0205,0.014,0.02,6.0,0.52281],["Infant",0.505,0.39,0.15,0.685,0.362,0.131,0.156,8.0,0.4988],["Female",0.67,0.585,0.16,1.309,0.5445,0.2945,0.413,10.0,0.59181],["Female",0.61,0.46,0.155,0.957,0.4255,0.1975,0.265,8.0,0.41261],["Female",0.69,0.54,0.185,1.5715,0.6935,0.318,0.47,15.0,0.492],["Female",0.62,0.48,0.16,1.1125,0.5635,0.2445,0.281,8.0,0.40211],["Male",0.64,0.49,0.155,1.1285,0.477,0.269,0.34,9.0,0.40412],["Male",0.35,0.255,0.08,0.1915,0.08,0.0385,0.063,9.0,0.48207],["Infant",0.58,0.44,0.145,0.7905,0.3525,0.1645,0.242,10.0,0.41468],["Infant",0.44,0.31,0.115,0.3625,0.134,0.082,0.12,11.0,0.4632],["Male",0.58,0.455,0.15,1.012,0.4985,0.2115,0.2835,10.0,0.36816],["Infant",0.5,0.375,0.12,0.529,0.2235,0.123,0.16,8.0,0.3697],["Male",0.58,0.455,0.135,0.7955,0.405,0.167,0.204,10.0,0.44878],["Male",0.38,0.27,0.095,0.219,0.0835,0.0515,0.07,6.0,0.4859],["Infant",0.265,0.205,0.07,0.1055,0.039,0.041,0.035,5.0,0.5174],["Male",0.65,0.525,0.19,1.4995,0.6265,0.4005,0.395,14.0,0.4922],["Female",0.64,0.5,0.15,1.0705,0.371,0.2705,0.36,8.0,0.51697],["Male",0.635,0.48,0.235,1.064,0.413,0.228,0.36,16.0,0.61132],["Male",0.525,0.4,0.17,0.7305,0.279,0.2055,0.195,11.0,0.50339],["Infant",0.435,0.33,0.095,0.393,0.219,0.075,0.0885,6.0,0.4861],["Male",0.5,0.38,0.12,0.5765,0.273,0.135,0.145,9.0,0.41866],["Male",0.605,0.465,0.165,1.056,0.4215,0.2475,0.34,13.0,0.39252],["Male",0.655,0.59,0.2,1.5455,0.654,0.3765,0.415,11.0,0.57866],["Female",0.58,0.455,0.12,1.0735,0.479,0.2735,0.265,10.0,0.50738],["Male",0.46,0.36,0.125,0.547,0.2165,0.1105,0.19,8.0,0.45841],["Infant",0.41,0.335,0.105,0.3305,0.1405,0.064,0.105,7.0,0.41261],["Female",0.29,0.21,0.075,0.275,0.113,0.0675,0.035,6.0,0.65313],["Male",0.67,0.525,0.17,1.4005,0.715,0.3025,0.387,9.0,0.43918],["Infant",0.445,0.34,0.145,0.434,0.1945,0.0905,0.13,7.0,0.51141],["Infant",0.245,0.175,0.055,0.0785,0.04,0.018,0.02,5.0,0.51183],["Male",0.35,0.26,0.09,0.198,0.0725,0.056,0.06,10.0,0.49528],["Male",0.72,0.57,0.2,1.8275,0.919,0.366,0.485,10.0,0.52107],["Female",0.57,0.47,0.14,0.871,0.385,0.211,0.2315,10.0,0.42764],["Male",0.585,0.45,0.15,0.997,0.4055,0.283,0.251,11.0,0.45366],["Infant",0.35,0.235,0.08,0.17,0.0725,0.0465,0.0495,7.0,0.45688],["Infant",0.515,0.395,0.125,0.6635,0.32,0.14,0.17,8.0,0.41278],["Infant",0.615,0.475,0.13,0.8425,0.353,0.1915,0.251,8.0,0.53202],["Infant",0.37,0.28,0.085,0.198,0.0805,0.0455,0.058,5.0,0.46089],["Male",0.34,0.275,0.09,0.2065,0.0725,0.043,0.07,10.0,0.50569],["Male",0.7,0.54,0.205,1.74,0.7885,0.373,0.4865,13.0,0.50485],["Infant",0.39,0.28,0.09,0.215,0.0845,0.034,0.079,8.0,0.47649],["Infant",0.385,0.285,0.09,0.248,0.0935,0.066,0.07,6.0,0.43554],["Infant",0.39,0.295,0.095,0.203,0.0875,0.045,0.075,7.0,0.44267],["Male",0.38,0.285,0.1,0.2665,0.115,0.061,0.075,11.0,0.50759],["Male",0.63,0.485,0.16,1.243,0.623,0.275,0.3,10.0,0.3862],["Female",0.605,0.48,0.14,0.991,0.4735,0.2345,0.24,8.0,0.44083],["Infant",0.315,0.23,0.07,0.164,0.0625,0.04,0.045,6.0,0.43845],["Infant",0.295,0.22,0.065,0.1295,0.052,0.028,0.035,6.0,0.44138],["Male",0.405,0.305,0.12,0.3185,0.1235,0.0905,0.095,7.0,0.51226],["Male",0.61,0.48,0.14,1.031,0.4375,0.2615,0.27,8.0,0.42322],["Male",0.47,0.365,0.12,0.612,0.327,0.15,0.14,8.0,0.47629],["Infant",0.19,0.13,0.045,0.0265,0.009,0.005,0.009,5.0,0.55995],["Male",0.6,0.46,0.155,0.9595,0.4455,0.189,0.295,11.0,0.39024],["Male",0.495,0.395,0.125,0.5415,0.2375,0.1345,0.155,9.0,0.43139],["Male",0.54,0.435,0.18,0.996,0.3835,0.226,0.325,17.0,0.50005],["Female",0.635,0.505,0.165,1.251,0.577,0.227,0.3825,11.0,0.408],["Male",0.625,0.515,0.165,1.217,0.667,0.2065,0.3115,10.0,0.48187],["Infant",0.575,0.45,0.17,0.9315,0.358,0.2145,0.26,13.0,0.47195],["Female",0.57,0.44,0.125,0.865,0.3675,0.1725,0.27,12.0,0.43446],["Female",0.7,0.575,0.2,1.7365,0.7755,0.3965,0.461,11.0,0.49694],["Infant",0.3,0.22,0.065,0.1195,0.052,0.0155,0.035,5.0,0.49159],["Infant",0.365,0.255,0.08,0.1985,0.0785,0.0345,0.053,5.0,0.4698],["Female",0.635,0.495,0.195,1.297,0.556,0.2985,0.37,11.0,0.40817],["Male",0.445,0.35,0.14,0.5905,0.2025,0.158,0.19,14.0,0.52042],["Infant",0.475,0.365,0.115,0.49,0.223,0.1235,0.1335,9.0,0.40783],["Female",0.61,0.485,0.165,1.0915,0.3935,0.2435,0.33,18.0,0.4753],["Female",0.53,0.41,0.145,0.8255,0.375,0.204,0.245,9.0,0.42534],["Male",0.595,0.475,0.14,0.944,0.3625,0.189,0.315,9.0,0.44028],["Female",0.65,0.5,0.16,1.3825,0.702,0.304,0.3195,9.0,0.44396],["Infant",0.405,0.305,0.1,0.268,0.1145,0.053,0.085,7.0,0.41296],["Female",0.64,0.505,0.165,1.2235,0.5215,0.2695,0.36,10.0,0.383],["Male",0.56,0.41,0.165,0.93,0.3505,0.237,0.3,13.0,0.4486],["Female",0.68,0.58,0.2,1.787,0.585,0.453,0.6,19.0,0.6273],["Male",0.625,0.5,0.17,1.0985,0.4645,0.22,0.354,9.0,0.41866],["Male",0.425,0.33,0.13,0.4405,0.152,0.0935,0.155,9.0,0.49016],["Infant",0.435,0.345,0.12,0.3215,0.13,0.056,0.1185,7.0,0.48731],["Infant",0.515,0.39,0.14,0.5555,0.2,0.1135,0.2235,12.0,0.49405],["Male",0.65,0.52,0.19,1.3445,0.519,0.306,0.4465,16.0,0.4607],["Infant",0.515,0.39,0.11,0.531,0.2415,0.098,0.1615,8.0,0.44267],["Male",0.515,0.4,0.14,0.6335,0.288,0.145,0.168,9.0,0.40868],["Male",0.415,0.315,0.12,0.4015,0.199,0.087,0.097,8.0,0.49159],["Male",0.72,0.55,0.205,2.125,1.1455,0.4425,0.511,13.0,0.61978],["Male",0.31,0.225,0.075,0.1295,0.0455,0.0335,0.044,9.0,0.54072],["Infant",0.54,0.395,0.135,0.6555,0.2705,0.155,0.192,9.0,0.428],["Infant",0.52,0.38,0.135,0.5395,0.2295,0.133,0.157,8.0,0.41779],["Infant",0.385,0.28,0.1,0.2755,0.1305,0.061,0.0725,8.0,0.43229],["Male",0.705,0.555,0.215,2.141,1.0465,0.383,0.528,11.0,0.6055],["Infant",0.38,0.285,0.085,0.237,0.115,0.0405,0.07,6.0,0.41589],["Infant",0.375,0.28,0.08,0.2025,0.0825,0.048,0.065,8.0,0.42835],["Infant",0.255,0.185,0.07,0.075,0.028,0.018,0.025,6.0,0.46532],["Male",0.63,0.49,0.15,1.1955,0.5845,0.257,0.3,9.0,0.38588],["Female",0.54,0.415,0.175,0.8975,0.275,0.241,0.275,14.0,0.51525],["Infant",0.395,0.27,0.1,0.2985,0.1445,0.061,0.082,5.0,0.50675],["Male",0.465,0.35,0.14,0.5755,0.2015,0.1505,0.19,15.0,0.50067],["Infant",0.28,0.22,0.08,0.1315,0.066,0.024,0.03,5.0,0.4922],["Male",0.48,0.38,0.135,0.528,0.2,0.1395,0.16,14.0,0.47176],["Male",0.345,0.255,0.08,0.169,0.06,0.0425,0.054,10.0,0.51632],["Female",0.495,0.385,0.135,0.6625,0.3005,0.1635,0.185,11.0,0.45329],["Infant",0.51,0.38,0.115,0.5155,0.215,0.1135,0.166,8.0,0.41073],["Female",0.69,0.53,0.17,1.5535,0.7945,0.3485,0.3695,9.0,0.51332],["Female",0.55,0.43,0.155,0.785,0.289,0.227,0.233,11.0,0.45272],["Infant",0.33,0.25,0.105,0.1715,0.0655,0.035,0.06,7.0,0.5015],["Female",0.685,0.525,0.175,1.71,0.5415,0.309,0.58,16.0,0.55324],["Female",0.56,0.44,0.14,0.9285,0.3825,0.188,0.3,11.0,0.42587],["Male",0.555,0.455,0.16,1.0575,0.3925,0.228,0.293,13.0,0.42604],["Female",0.51,0.34,0.18,0.7005,0.312,0.165,0.2,11.0,0.60374],["Infant",0.265,0.21,0.06,0.0965,0.0425,0.022,0.03,5.0,0.46185],["Male",0.56,0.445,0.16,0.8965,0.42,0.2175,0.2215,8.0,0.42392],["Female",0.615,0.5,0.165,1.1765,0.488,0.244,0.345,17.0,0.48127],["Infant",0.335,0.25,0.08,0.167,0.0675,0.0325,0.0575,6.0,0.42076],["Male",0.44,0.355,0.125,0.4775,0.132,0.0815,0.19,9.0,0.53982],["Infant",0.44,0.33,0.135,0.4095,0.163,0.1005,0.119,6.0,0.48207],["Male",0.415,0.3,0.1,0.3355,0.1545,0.0685,0.095,7.0,0.4861],["Infant",0.39,0.29,0.09,0.2625,0.117,0.054,0.077,7.0,0.39285],["Female",0.58,0.455,0.165,1.1365,0.369,0.3005,0.275,13.0,0.48752],["Female",0.585,0.46,0.15,1.0035,0.503,0.2105,0.2515,11.0,0.39878],["Male",0.645,0.51,0.19,1.4865,0.6445,0.296,0.425,12.0,0.4264],["Female",0.585,0.465,0.145,0.9855,0.4325,0.2145,0.2845,10.0,0.36878],["Male",0.55,0.425,0.16,0.793,0.343,0.2035,0.215,9.0,0.42534],["Male",0.6,0.5,0.16,1.015,0.3995,0.1735,0.33,19.0,0.51826],["Female",0.57,0.44,0.14,0.9535,0.3785,0.201,0.305,17.0,0.48955],["Infant",0.22,0.16,0.05,0.049,0.0215,0.01,0.015,4.0,0.52521],["Infant",0.265,0.2,0.065,0.0975,0.04,0.0205,0.028,7.0,0.4698],["Infant",0.4,0.315,0.09,0.33,0.151,0.068,0.08,6.0,0.44377],["Infant",0.555,0.455,0.17,0.8435,0.309,0.1905,0.3,15.0,0.51268],["Male",0.465,0.36,0.08,0.488,0.191,0.125,0.155,11.0,0.58495],["Male",0.575,0.45,0.155,0.886,0.3605,0.211,0.2575,9.0,0.36786],["Male",0.515,0.385,0.13,0.623,0.2855,0.1285,0.175,10.0,0.41261],["Female",0.49,0.385,0.15,0.7865,0.241,0.14,0.24,23.0,0.64906],["Female",0.46,0.375,0.12,0.4915,0.2205,0.088,0.17,7.0,0.49159],["Infant",0.59,0.475,0.145,0.9745,0.4675,0.207,0.259,10.0,0.46474],["Infant",0.24,0.17,0.05,0.0545,0.0205,0.016,0.0155,5.0,0.53224],["Infant",0.35,0.26,0.085,0.174,0.0705,0.0345,0.06,10.0,0.49673],["Infant",0.29,0.21,0.07,0.1115,0.048,0.0205,0.03,5.0,0.44841],["Female",0.615,0.485,0.16,1.1575,0.5005,0.2495,0.315,10.0,0.36375],["Male",0.545,0.435,0.165,0.9955,0.3245,0.2665,0.325,19.0,0.52893],["Infant",0.625,0.485,0.15,1.044,0.438,0.2865,0.278,9.0,0.53114],["Male",0.6,0.475,0.15,1.089,0.5195,0.223,0.292,11.0,0.3697],["Male",0.5,0.415,0.165,0.6885,0.249,0.138,0.25,13.0,0.48428],["Male",0.6,0.495,0.175,1.3005,0.6195,0.284,0.3285,11.0,0.40244],["Male",0.53,0.4,0.125,0.7575,0.398,0.151,0.175,8.0,0.47058],["Male",0.46,0.355,0.14,0.491,0.207,0.115,0.174,10.0,0.44064],["Female",0.63,0.485,0.17,1.3205,0.5945,0.345,0.345,9.0,0.43247],["Infant",0.37,0.28,0.095,0.2865,0.1505,0.069,0.0795,7.0,0.45159],["Male",0.475,0.375,0.125,0.593,0.277,0.115,0.18,10.0,0.42746],["Female",0.595,0.455,0.16,1.04,0.452,0.2655,0.288,9.0,0.3759],["Male",0.59,0.475,0.14,0.977,0.4625,0.2025,0.275,10.0,0.38508],["Female",0.575,0.435,0.15,1.0305,0.4605,0.218,0.36,8.0,0.47333],["Infant",0.185,0.375,0.12,0.4645,0.196,0.1045,0.15,6.0,0.67467],["Female",0.655,0.51,0.155,1.2895,0.5345,0.2855,0.41,11.0,0.43973],["Infant",0.475,0.365,0.105,0.4175,0.1645,0.099,0.127,7.0,0.44248],["Female",0.515,0.43,0.14,0.834,0.367,0.2,0.23,8.0,0.45745],["Infant",0.605,0.495,0.145,1.054,0.369,0.2255,0.36,12.0,0.52893],["Female",0.545,0.44,0.135,0.9185,0.429,0.2015,0.2375,10.0,0.43247],["Female",0.37,0.275,0.1,0.2225,0.093,0.026,0.08,8.0,0.55324],["Infant",0.47,0.375,0.105,0.468,0.1665,0.108,0.17,10.0,0.4632],["Infant",0.335,0.26,0.09,0.1965,0.0875,0.041,0.056,7.0,0.4109],["Female",0.525,0.44,0.125,0.7115,0.3205,0.159,0.1915,7.0,0.50109],["Infant",0.41,0.305,0.09,0.3535,0.157,0.0745,0.1,7.0,0.43991],["Male",0.63,0.49,0.165,1.2005,0.575,0.273,0.294,10.0,0.37341],["Infant",0.57,0.45,0.145,0.751,0.2825,0.2195,0.2215,10.0,0.4957],["Female",0.65,0.495,0.16,1.3105,0.577,0.3315,0.355,9.0,0.42111],["Male",0.7,0.555,0.2,1.858,0.73,0.3665,0.595,11.0,0.53269],["Female",0.615,0.475,0.155,1.115,0.484,0.2115,0.355,10.0,0.37841],["Infant",0.355,0.26,0.09,0.1985,0.0715,0.0495,0.058,7.0,0.4241],["Infant",0.375,0.26,0.08,0.2075,0.09,0.0415,0.07,6.0,0.43319],["Male",0.695,0.57,0.2,2.033,0.751,0.4255,0.685,15.0,0.61874],["Male",0.655,0.525,0.16,1.46,0.686,0.311,0.405,11.0,0.43265],["Infant",0.555,0.43,0.14,0.7665,0.341,0.165,0.23,9.0,0.39465],["Infant",0.345,0.285,0.1,0.2225,0.0865,0.058,0.075,8.0,0.45917],["Female",0.52,0.405,0.145,0.829,0.3535,0.1685,0.205,15.0,0.48047],["Infant",0.435,0.33,0.105,0.335,0.156,0.0555,0.105,8.0,0.43229],["Infant",0.36,0.28,0.09,0.2255,0.0885,0.04,0.09,8.0,0.45707],["Male",0.59,0.46,0.145,0.929,0.38,0.24,0.255,10.0,0.38894],["Male",0.655,0.515,0.2,1.373,0.443,0.3375,0.49,16.0,0.52959],["Male",0.635,0.48,0.19,1.467,0.5825,0.303,0.42,15.0,0.46726],["Female",0.66,0.53,0.17,1.326,0.519,0.2625,0.44,13.0,0.45764],["Male",0.63,0.49,0.155,1.2525,0.63,0.246,0.289,9.0,0.42093],["Male",0.54,0.41,0.145,0.989,0.2815,0.213,0.355,19.0,0.55301],["Infant",0.35,0.26,0.095,0.211,0.086,0.056,0.068,7.0,0.41989],["Female",0.595,0.465,0.15,0.98,0.4115,0.196,0.2255,10.0,0.41364],["Female",0.58,0.475,0.135,0.925,0.391,0.165,0.275,14.0,0.46824],["Male",0.51,0.39,0.125,0.6565,0.262,0.1835,0.175,10.0,0.45159],["Female",0.535,0.405,0.125,0.927,0.26,0.1425,0.345,16.0,0.57987],["Infant",0.5,0.375,0.14,0.559,0.2375,0.135,0.169,9.0,0.40244],["Male",0.48,0.375,0.145,0.777,0.216,0.13,0.17,9.0,0.51311],["Female",0.72,0.59,0.205,1.7495,0.7755,0.4225,0.48,11.0,0.54706],["Female",0.57,0.44,0.19,1.018,0.447,0.207,0.265,9.0,0.48308],["Female",0.54,0.44,0.135,0.959,0.2385,0.221,0.3,17.0,0.57101],["Infant",0.41,0.31,0.11,0.315,0.124,0.082,0.095,9.0,0.44138],["Male",0.57,0.42,0.14,0.8745,0.416,0.165,0.25,8.0,0.42764],["Male",0.52,0.465,0.15,0.9505,0.456,0.199,0.255,8.0,0.47808],["Female",0.58,0.435,0.14,0.953,0.475,0.2165,0.2095,9.0,0.45103],["Infant",0.385,0.29,0.08,0.2485,0.122,0.0495,0.065,7.0,0.44655],["Female",0.515,0.4,0.125,0.615,0.2865,0.123,0.1765,8.0,0.43536],["Infant",0.465,0.37,0.115,0.534,0.261,0.098,0.143,7.0,0.41745],["Female",0.655,0.54,0.175,1.5585,0.7285,0.402,0.385,11.0,0.48752],["Female",0.645,0.515,0.175,1.546,0.7035,0.365,0.415,10.0,0.45009],["Female",0.51,0.38,0.13,0.584,0.224,0.1355,0.185,13.0,0.44916],["Male",0.62,0.475,0.195,1.3585,0.5935,0.3365,0.3745,10.0,0.46224],["Male",0.74,0.58,0.205,2.381,0.8155,0.4695,0.488,12.0,0.63306],["Female",0.57,0.465,0.18,0.9995,0.405,0.277,0.295,16.0,0.4861],["Infant",0.36,0.265,0.075,0.1845,0.083,0.0365,0.055,7.0,0.42835],["Female",0.47,0.375,0.12,0.6015,0.2765,0.1455,0.135,8.0,0.47136],["Male",0.45,0.335,0.14,0.4625,0.164,0.076,0.15,14.0,0.52455],["Female",0.345,0.26,0.09,0.207,0.0775,0.0435,0.0765,10.0,0.5387],["Infant",0.375,0.28,0.09,0.215,0.084,0.06,0.055,6.0,0.44618],["Male",0.325,0.23,0.09,0.147,0.06,0.034,0.045,4.0,0.58837],["Male",0.67,0.525,0.18,1.4915,0.728,0.343,0.381,9.0,0.45084],["Male",0.675,0.505,0.16,1.532,0.74,0.357,0.3815,11.0,0.47274],["Infant",0.325,0.2,0.08,0.0995,0.0395,0.0225,0.032,8.0,0.54615],["Female",0.705,0.555,0.195,1.7525,0.7105,0.4215,0.516,12.0,0.49776],["Female",0.71,0.575,0.175,1.555,0.6465,0.3705,0.52,15.0,0.56628],["Infant",0.435,0.335,0.11,0.334,0.1355,0.0775,0.0965,7.0,0.40412],["Female",0.655,0.525,0.19,1.3595,0.564,0.3215,0.3985,10.0,0.40395],["Female",0.475,0.375,0.125,0.588,0.237,0.1715,0.155,10.0,0.48368],["Male",0.4,0.32,0.095,0.303,0.1335,0.06,0.1,7.0,0.48067],["Male",0.52,0.4,0.165,0.8565,0.2745,0.201,0.21,12.0,0.4859],["Female",0.505,0.395,0.145,0.6515,0.2695,0.153,0.205,15.0,0.45556],["Male",0.555,0.46,0.16,0.86,0.3345,0.1935,0.275,10.0,0.40716],["Female",0.665,0.515,0.185,1.3405,0.5595,0.293,0.4375,11.0,0.42782],["Female",0.445,0.33,0.105,0.4525,0.18,0.103,0.123,9.0,0.46824],["Male",0.635,0.525,0.16,1.195,0.5435,0.246,0.335,12.0,0.43554],["Female",0.425,0.335,0.095,0.322,0.1205,0.061,0.125,10.0,0.54729],["Female",0.6,0.475,0.155,1.21,0.653,0.1695,0.3205,10.0,0.51332],["Male",0.595,0.48,0.14,0.9125,0.4095,0.1825,0.289,9.0,0.4296],["Female",0.53,0.43,0.15,0.741,0.325,0.1855,0.196,9.0,0.42996],["Female",0.575,0.46,0.16,1.103,0.538,0.221,0.249,9.0,0.41244],["Female",0.47,0.355,0.18,0.441,0.1525,0.1165,0.135,8.0,0.59058],["Male",0.68,0.52,0.195,1.4535,0.592,0.391,0.4125,10.0,0.4698],["Infant",0.3,0.23,0.085,0.117,0.05,0.0175,0.0415,6.0,0.50401],["Infant",0.4,0.32,0.095,0.348,0.194,0.053,0.087,6.0,0.50005],["Male",0.625,0.47,0.17,1.1665,0.4605,0.2565,0.3945,11.0,0.42534],["Infant",0.62,0.485,0.18,1.154,0.4935,0.256,0.315,12.0,0.47353]]}
</script>
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.domain {
stroke: #ddd;
stoke-width: 1px;
fill: none;
}
.tick line {
stroke: #ddd;
stroke-dasharray: 3,3;
}
.field {
cursor: pointer;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.brush .extent {
stroke: #fff;
fill-opacity: .125;
shape-rendering: crispEdges;
}
svg {
-webkit-user-select: none; /* webkit (safari, chrome) browsers */
-moz-user-select: none; /* mozilla browsers */
-khtml-user-select: none; /* webkit (konqueror) browsers */
-ms-user-select: none; /* IE10+ */
}
.field-marker {
}
</style>
<body oncontextmenu="return false;">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
function getParam(key) {
if(key=(new RegExp('[?&]'+encodeURIComponent(key)+'=([^&]*)'))
.exec(location.search))
return decodeURIComponent(key[1]);
}
function setParam(key, value) {
key = encodeURI(key); value = encodeURI(value);
var s = document.location.search;
var kvp = key+"="+value;
var r = new RegExp("(&|\\?)"+key+"=[^\&]*");
s = s.replace(r,"$1"+kvp);
if(!RegExp.$1) {s += (s.length>0 ? '&' : '?') + kvp;};
window.history.replaceState({}, "", s);
}
function removeParam(key) {
var sourceURL = document.location.search;
var rtn = sourceURL.split("?")[0],
param,
params_arr = [],
queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
if (queryString !== "") {
params_arr = queryString.split("&");
for (var i = params_arr.length - 1; i >= 0; i -= 1) {
param = params_arr[i].split("=")[0];
if (param === key) {
params_arr.splice(i, 1);
}
}
rtn = rtn + "?" + params_arr.join("&");
}
window.history.replaceState({}, "", rtn);
}
var margin = {top: 20, right: 20, bottom: 20, left: 20},
width = 1000 - margin.left - margin.right,
height = 640 - margin.bottom - margin.top;
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var defs = d3.select("svg").append("defs");
d3.json("abalone.json", function(error, data) {
var fields = data.fields;
var rows = data.rows;
var shows;
var buffer = width / 20;
var field_size = width / 4;
var right_fields = 250;
var plotWidth = width - 2 * buffer - right_fields;
var plotHeight = 0.75 * height;
resetConstraints();
function resetConstraints() {
for (var i = 0; i < fields.length; i++) {
fields[i].constraint = false;
}
shows = [];
for (var i = 0; i < rows.length; i++) {
shows.push(true);
}
evalConstraints();
}
function evalConstraints() {
var visiblePoints = 0;
for (var i = 0; i < rows.length; i++) {
var show = true;
for (var j = 0; j < fields.length && show; j++) {
var field = fields[j];
if (field.constraint) {
var val = rows[i][j];
if ((field.optype == "numeric" &&
(val < field.minConstraint || val > field.maxConstraint)) ||
(field.optype == "categorical" && !(val in field.catConstraint))) {
show = false;
}
}
}
if (show) visiblePoints += 1;
shows[i] = show;
}
if (visiblePoints == 0) {
resetConstraints();
} else {
r = Math.pow((6 * Math.min(plotWidth, plotHeight)) / Math.min(visiblePoints, 1024), 0.5);
}
}
var brushX = d3.scale.identity().domain([buffer, plotWidth]),
brushY = d3.scale.identity().domain([0, plotHeight]);
var brushExtent;
var brush = d3.svg.brush()
.x(brushX)
.y(brushY)
.on("brush", brushed)
.on("brushend", brushended);
svg.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.event);
function brushed() {
brushExtent = brush.extent();
}
function brushended() {
var validConstraint = true;
if (!d3.event.sourceEvent) return; // only transition after input
if (fields[x].optype == "numeric") {
fields[x].minConstraint = xScale.invert(brushExtent[0][0]);
fields[x].maxConstraint = xScale.invert(brushExtent[1][0]);
} else {
var cats = fields[x].cats;
var selected = {};
for (var i = 0; i < cats.length; i++) {
var val = xScale(cats[i]);
if (val >= brushExtent[0][0] && val <= brushExtent[1][0]) {
selected[cats[i]] = true;
}
}
fields[x].catConstraint = selected;
}
if (fields[y].optype == "numeric") {
fields[y].minConstraint = yScale.invert(brushExtent[1][1]);
fields[y].maxConstraint = yScale.invert(brushExtent[0][1]);
} else {
var cats = fields[y].cats;
var selected = {};
for (var i = 0; i < cats.length; i++) {
var val = yScale(cats[i]);
if (val >= brushExtent[0][1] && val <= brushExtent[1][1]) {
selected[cats[i]] = true;
}
}
if (selected.length == 0) {
validConstraint = false;
}
fields[y].catConstraint = selected;
}
d3.select(this).call(brush.extent([[0, 0], [0, 0]]));
if (validConstraint) {
fields[x].constraint = true;
fields[y].constraint = true;
evalConstraints();
updateForClick();
} else {
fields[x].constraint = false;
fields[y].constraint = false;
}
}
var maxNameChars = 0;
for (var i = 0; i < fields.length; i++) {
maxNameChars = Math.max(maxNameChars, fields[i].name.length);
}
var valueOffset = 9 * maxNameChars;
for (var i = 0; i < fields.length; i++) {
fields[i].constraint = false;
makeField(fields[i], i);
calcRange(i);
}
var hintY = i * 28;
var hintX = width - right_fields - buffer;
hint = svg.append("g").attr("class", "hint").style("font-size","12px");
hint.append("text")
.attr("transform", "translate(" + hintX + "," + (hintY + 20) + ")")
.text("Left click --> Set X Axis");
hint.append("text")
.attr("transform", "translate(" + hintX + "," + (hintY + 35) + ")")
.text("Right click --> Set Y Axis");
hint.append("text")
.attr("transform", "translate(" + hintX + "," + (hintY + 50) + ")")
.text("Alt + left click --> Set Color");
var fcX = width - right_fields - buffer + valueOffset;
var fcY = -5;
svg.append("g").attr("class", "field-counter").append("text")
.attr("transform", "translate(" + fcX + "," + fcY + ")");
var gx, gy;
var xAxis, yAxis;
var xScale;
var yScale;
var uniqueMap;
var xMap;
var yMap;
var colorMap;
var colorFn;
var currentRow = null;
var currentIds;
var x = getParam("x");
var y = getParam("y");
var c = getParam("c");
if (x == null) x = 4;
if (y == null) y = 1;
if (c == null) c = fields.length - 1;
setParam("x", x);
setParam("y", y);
setParam("c", c);
var xLogMode = getParam("xLog");
var yLogMode = getParam("yLog");
var cLogMode = getParam("cLog");
if (xLogMode == null) xLogMode = false;
if (yLogMode == null) yLogMode = false;
if (cLogMode == null) cLogMode = false;
var granularity = getParam("g");
if (granularity == null) granularity = 1;
var pointIndex = 0;
var r;
makeAxis();
makePoints();
updateForClick();
function genKey(row) {
var xVal, yVal;
var g = 1 + ((granularity - 1) * 5);
if (fields[x].optype == "numeric") {
xVal = Math.round(xScale(row[x]) / g) * g;
} else {
xVal = row[x];
}
if (fields[y].optype == "numeric") {
yVal = Math.round(yScale(row[y]) / g) * g;
} else {
yVal = row[y];
}
return xVal.toString() + "," + yVal.toString();
}
d3.select("body").on("keydown", keydown);
function keydown() {
var needUpdate = true;
var lastKeyDown = d3.event.keyCode;
if (lastKeyDown >= 49 && lastKeyDown <= 57) {
granularity = lastKeyDown - 48;
if (granularity == 1) {
removeParam("g");
} else {
setParam("g", granularity);
}
updateForClick();
}
}
function updateForClick() {
updateScales();
updateUniqueMap();
updateColorFn();
updatePoints();
updateFieldMarkers();
updateAxis();
}
function makeField(field, index) {
var x_loc = width - right_fields - buffer;
var y_loc = 20 + index * 28;
var field_text = svg.append("g")
.attr("class", "field");
field_text.append("text")
.attr("class", "field")
.attr("transform", "translate(" + x_loc + "," + y_loc + ")")
.on("click", function() {
if (d3.event.altKey) {
if (c == index && fields[c].optype == "numeric") {
cLogMode = !cLogMode;
} else {
cLogMode = false;
}
if (cLogMode == true) {
setParam("cLog", true);
} else {
removeParam("cLog");
}
c = index;
setParam("c", index);
} else {
if (x == index && fields[x].optype == "numeric") {
xLogMode = !xLogMode;
} else {
xLogMode = false;
}
if (xLogMode == true) {
setParam("xLog", true);
} else {
removeParam("xLog");
}
x = index;
setParam("x", index);
}
updateForClick();
})
.on("contextmenu", function() {
if (y == index && fields[y].optype == "numeric") {
yLogMode = !yLogMode;
} else {
yLogMode = false;
}
if (yLogMode == true) {
setParam("yLog", true);
} else {
removeParam("yLog");
}
y = index;
setParam("y", index);
updateForClick();
})
.text(field.name);
svg.append("g")
.append("text")
.attr("class", "field-value")
.attr("transform", "translate(" + (valueOffset + x_loc) + "," + y_loc + ")");
svg.append("g")
.append("text")
.attr("class", "field-marker")
.attr("transform", "translate(" + (-6 + x_loc) + "," + y_loc + ")")
.style("text-anchor", "end")
.text("");
}
function makeAxis() {
gy = svg.append("g")
.attr("class", "y-axis")
.attr("transform", "translate(" + buffer + "," + 0 + ")");
gx = svg.append("g")
.attr("class", "x-axis")
.attr("transform", "translate(" + 0 + "," + plotHeight + ")");
}
function updateAxis() {
var currentY = gy.transition()
.duration(700)
.call(yAxis);
if (fields[y].optype == "categorical") {
currentY.selectAll("text")
.attr("y", 10)
.attr("x", 2)
.style("fill", "#999")
.style("font-size", "13")
.style("text-anchor", "start");
}
var currentX = gx.transition()
.duration(700)
.call(xAxis);
if (fields[x].optype == "categorical") { // && fields[x].cats.length > 4) {
currentX.selectAll("text")
.attr("y", 5)
.attr("x", 2)
.attr("transform", "rotate(-90)")
.style("fill", "#999")
.style("font-size", "13")
.style("text-anchor", "start");
}
}
function updateFieldMarkers() {
var ids = Array.apply(null, Array(fields.length)).map(function (_, i) {return i;});
svg.selectAll(".field-marker")
.data(ids)
.text(function(d) {
var marker = "";
if (d == x) {
if (xLogMode) {
marker += "x";
} else {
marker += "X";
}
}
if (d == y) {
if (yLogMode) {
marker += "y";
} else {
marker += "Y";
}
}
if (d == c) {
if (cLogMode) {
marker += "c";
} else {
marker += "C";
}
}
if (marker != "") { marker += ":"};
return marker;
})
}
function updateFieldValues() {
var ids = Array.apply(null, Array(fields.length)).map(function (_, i) {return i;});
var currentRow;
if (currentIds != null) {
currentRow = rows[currentIds[pointIndex % currentIds.length]];
}
svg.selectAll(".field-value")
.data(ids)
.text(function(d) {
var val = "";
if (currentRow != null) {
val += currentRow[d].toString();
}
return val;
});
svg.select(".field-counter").select("text")
.text(function(d) {
var str = "";
if (currentIds != null && currentIds.length > 1) {
str += (1 + pointIndex % currentIds.length) + " of " + currentIds.length;
}
return str;
});
}
function updateUniqueMap() {
uniqueMap = {};
for (var i = 0; i < rows.length; i++) {
if (shows[i]) {
var key = genKey(rows[i]);
if (key in uniqueMap) {
uniqueMap[key].push(i);
} else {
uniqueMap[key] = [i];
}
}
}
colorMap = {};
xMap = {};
yMap = {};
for (var key in uniqueMap) {
var ids = uniqueMap[key];
if (ids.length > 1) {
if (fields[x].optype == "numeric") {
var sum = 0;
for (var j = 0; j < ids.length; j++) {
sum += rows[ids[j]][x];
}
xMap[key] = sum / ids.length;
} else {
xMap[key] = rows[ids[0]][x];
}
if (fields[y].optype == "numeric") {
var sum = 0;
for (var j = 0; j < ids.length; j++) {
sum += rows[ids[j]][y];
}
yMap[key] = sum / ids.length;
} else {
yMap[key] = rows[ids[0]][y];
}
if (fields[c].optype == "numeric") {
var sum = 0;
for (var j = 0; j < ids.length; j++) {
sum += rows[ids[j]][c];
}
colorMap[key] = sum / ids.length;
} else {
var cat_counts = {};
for (var j = 0; j < ids.length; j++) {
var cat = rows[ids[j]][c];
if (cat in cat_counts) {
cat_counts[cat] = cat_counts[cat] + 1;
} else {
cat_counts[cat] = 1;
}
}
var max_count = 0;
var max_cat;
for (cat in cat_counts) {
if (cat_counts[cat] > max_count) {
max_count = cat_counts[cat];
max_cat = cat;
}
}
colorMap[key] = max_cat;
if (rows[ids[0]][c] != max_cat) {
for (var j = 0; j < ids.length; j++) {
if (rows[ids[j]][c] == max_cat) {
var temp = ids[0];
ids[0] = ids[j];
ids[j] = temp;
break;
}
}
}
}
} else {
colorMap[key] = rows[ids[0]][c];
xMap[key] = rows[ids[0]][x];
yMap[key] = rows[ids[0]][y];
}
}
}
function updateColorFn() {
if (fields[c].optype == "numeric") {
if (cLogMode && fields[c].min > 0) {
colorFn = d3.scale.log()
.domain([fields[c].min, fields[c].max])
.range(["#3f3", "#f55"])
} else {
if (cLogMode) removeParam("cLog");
colorFn = d3.scale.linear()
.domain([fields[c].min, fields[c].max])
.range(["#3f3", "#f55"])
}
} else {
if (fields[c].cats.length <= 10) {
colorFn = d3.scale.category10().domain(fields[c].cats);
} else {
colorFn = d3.scale.category20().domain(fields[c].cats);
}
}
}
function calcRange(col) {
if (fields[col].optype == "numeric") {
var min = rows[0][col];
var max = rows[0][col];
for (var i = 0; i < rows.length; i++) {
min = Math.min(min, rows[i][col]);
max = Math.max(max, rows[i][col]);
}
fields[col].min = min;
fields[col].max = max;
} else {
var categories = {};
for (var i = 0; i < rows.length; i++) {
var val = rows[i][col];
if (val == null || val == "") {
val = "?";
rows[i][col] = val;
}
categories[val] = true;
}
var finalCats = [];
for (var cat in categories) {
finalCats.push(cat);
}
fields[col].cats = finalCats.sort();
}
}
function updateScale(col, rangeMin, rangeMax, isX) {
if (fields[col].optype == "numeric") {
var firstIndex;
for (firstIndex = 0; firstIndex < shows.length; firstIndex++) {
if (shows[firstIndex]) {
break;
}
}
var min = rows[firstIndex][col];
var max = rows[firstIndex][col];
var uniques = {};
var uniqueCount = 0;
for (var i = 0; i < rows.length; i++) {
if (shows[i]) {
var key = rows[i][col].toString();
if (!(key in uniques)) {
uniques[key] = true;
uniqueCount += 1;
}
min = Math.min(min, rows[i][col]);
max = Math.max(max, rows[i][col]);
}
}
if (min == max) {
var buf = (fields[col].max - fields[col].min) / 100;
if (buf == 0) {
buf = 0.1;
}
min -= buf;
max += buf;
}
if (min > 0 && ((col == x && xLogMode && isX) || (col == y && yLogMode && !isX))) {
return d3.scale.log()
.range([rangeMin, rangeMax])
.domain([min, max]);
} else {
if (min <= 0 && ((col == x && xLogMode && isX) || (col == y && yLogMode && !isX))) {
if (isX) {
xLogMode = false;
removeParam("xLog");
} else {
yLogMode = false;
removeParam("yLog");
}
}
var diff = max - min;
if (uniqueCount > 4) {
max += diff / 30;
min -= diff / 30;
} else {
max += diff / 5;
min -= diff / 5;
}
return d3.scale.linear()
.range([rangeMin, rangeMax])
.domain([min, max]);
}
} else {
if (isX) {
xLogMode = false;
} else {
yLogMode = false;
}
var categories = {};
for (var i = 0; i < rows.length; i++) {
categories[rows[i][col]] = true;
}
var finalCats = [];
for (var cat in categories) {
if (!fields[col].constraint || cat in fields[col].catConstraint) {
finalCats.push(cat);
}
}
return d3.scale.ordinal()
.domain(finalCats.sort())
.rangePoints([rangeMin, rangeMax], 1);
}
}
function updateScales () {
xScale = updateScale(x, buffer, plotWidth, true);
yScale = updateScale(y, plotHeight, 0, false);
xAxis = d3.svg.axis()
.scale(xScale)
.orient("bottom")
.tickPadding(10)
.tickSize(-plotHeight);
yAxis = d3.svg.axis()
.scale(yScale)
.orient("left")
.tickPadding(10)
.tickSize(-plotWidth + buffer);
}
function point_size(index) {
if (shows[index]) {
return r * Math.pow(uniqueMap[genKey(rows[index])].length, 0.5);
} else {
return r;
}
}
function makePoints() {
svg.selectAll(".data")
.data(Array.apply(null, Array(rows.length)).map(function (_, i) {return i;}))
.enter()
.append("g")
.attr("class", "data")
.style("opacity", "0")
.style("fill", "#fff")
.style("stroke", "#fff")
.style("stroke-width", "1.5")
.append("circle")
.attr("class", "point")
.on("click", function(d) {
pointIndex += 1;
updateFieldValues();
})
.on("mouseover", function(d) {
d3.select(this)
.attr("r", point_size(d) + Math.pow(point_size(d), 0.15) + 1);
currentIds = uniqueMap[genKey(rows[d])];
updateFieldValues();
})
.on("mouseout", function(d) {
d3.select(this)
.attr("r", (point_size(d)));
currentIds = null;
pointIndex = 0;
updateFieldValues();
});
}
function updatePoints() {
var transitions = 0;
svg.selectAll(".data")
.style("cursor", function (d) {
if (shows[d] && uniqueMap[genKey(rows[d])].length > 1) {
return "pointer";
} else {
return "auto";
}
})
.sort(function (a, b) {
var pa = point_size(a);
var pb = point_size(b);
if (pa == pb) {
if (a > b) {
return -1;
} else {
return 1;
}
}
if (pa > pb) {
return -1;
} else {
return 1;
}
})
.transition()
.duration(700)
.style("opacity", function (d) {
if (shows[d] && uniqueMap[genKey(rows[d])][0] == d) {
return "0.9";
} else {
return "0";
}
})
.style("fill", function(d) {
if (shows[d]) {
return colorFn(colorMap[genKey(rows[d])]);
} else {
return "#999";
}
})
.style("stroke", function(d) {
if (shows[d]) {
return d3.rgb(colorFn(colorMap[genKey(rows[d])])).darker(0.3);
} else {
return "#999";
}
})
.select(".point")
.attr("display", function (d) {
if (shows[d]) {
return "inherit";
} else {
return "none";
}
})
.attr("r", function(d) {
return point_size(d);
})
.attr("cx", function(d) {
var key = genKey(rows[d]);
if (key in xMap) {
return xScale(xMap[key]);
} else {
if (fields[x].optype == "numeric") {
return Math.round(xScale(rows[d][x]));
} else {
return xScale(rows[d][x]);
}
}
})
.attr("cy", function(d) {
var key = genKey(rows[d]);
if (key in yMap) {
return yScale(yMap[key]);
} else {
if (fields[y].optype == "numeric") {
return Math.round(yScale(rows[d][y]));
} else {
return yScale(rows[d][y]);
}
}
})
.transition()
.attr("display", function (d) {
if (shows[d] && uniqueMap[genKey(rows[d])][0] == d) {
return "inherit";
} else {
return "none";
}
});
}
function revealPoints() {
svg.selectAll(".data")
.data(Array.apply(null, Array(rows.length)).map(function (_, i) {return i;}))
.select(".point")
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment