Skip to content

Instantly share code, notes, and snippets.

@nkabrown
Last active March 3, 2016 14:18
Show Gist options
  • Save nkabrown/331874c70081130ec03b to your computer and use it in GitHub Desktop.
Save nkabrown/331874c70081130ec03b to your computer and use it in GitHub Desktop.
d3 contour map
<!DOCTYPE html>
<meta charset="UTF-8">
<title>D3 Contour Map</title>
<style>
html,
body {
background: #000;
}
.container {
width: 100%;
}
.contourmap {
width: 90%;
margin: 0 auto;
margin-top: 75px;
}
</style>
<div class="container">
<div class="contourmap"></div>
</div>
<script src="//d3js.org/d3.v3.min.js"></script>
<script>
// dataset and setup adapted from http://vis.supstat.com/2012/11/contour-plots-with-d3-and-r/
const data = [{
"x": [1,0.988,0.978,0.977,0.965,0.955,0.953,0.943,0.942,0.931,0.93,0.92,0.919,0.908,0.907,0.896,0.895,0.884,0.884,0.872,0.872,0.861,0.86,0.849,0.849,0.837,0.837,0.826,0.826,0.815,0.815,0.814,0.803,0.802,0.792,0.792,0.792,0.791,0.78,0.78,0.78,0.78,0.779,0.769,0.769,0.769,0.769],
"y": [0.552,0.552,0.567,0.568,0.568,0.583,0.585,0.6,0.602,0.617,0.618,0.633,0.635,0.65,0.652,0.667,0.667,0.683,0.684,0.7,0.701,0.717,0.717,0.733,0.734,0.75,0.751,0.767,0.767,0.783,0.8,0.802,0.817,0.818,0.833,0.85,0.867,0.868,0.883,0.9,0.917,0.933,0.935,0.95,0.967,0.983,1]
},
{
"x": [0.908,0.919,0.93,0.942,0.943,0.943,0.943,0.953,0.955,0.965,0.966,0.977,0.978,0.988,0.989,1],
"y": [0,0.015,0.015,0.015,0.017,0.033,0.05,0.065,0.067,0.082,0.083,0.098,0.1,0.115,0.117,0.132]
},
{
"x": [1,0.989,0.988,0.977,0.966,0.966,0.977,0.978,0.988,0.989,1],
"y": [0.168,0.183,0.185,0.185,0.2,0.217,0.232,0.233,0.248,0.25,0.265]
},
{
"x": [0.127,0.116,0.115,0.115,0.105,0.104,0.104,0.104,0.104,0.105,0.115,0.115,0.116,0.105,0.104,0.104,0.093,0.092,0.089,0.081,0.081,0.073,0.07,0.064,0.058,0.058,0.058,0.052,0.049,0.047,0.046,0.041,0.035,0.035,0.031,0.023,0.023,0.02,0.015,0.012,0.011,0.011,0.011,0.011,0],
"y": [0,0.015,0.017,0.033,0.048,0.05,0.067,0.083,0.1,0.102,0.117,0.133,0.15,0.166,0.167,0.183,0.199,0.2,0.217,0.233,0.233,0.25,0.258,0.267,0.282,0.283,0.3,0.317,0.333,0.348,0.35,0.367,0.383,0.383,0.4,0.416,0.417,0.433,0.45,0.465,0.467,0.483,0.5,0.517,0.533]
},
{
"x": [0,0.011,0.011,0.011,0.012,0.017,0.023,0.022,0.022,0.022,0.023,0.034,0.035,0.045,0.045,0.045,0.047,0.057,0.058,0.069,0.07,0.08,0.081,0.092,0.093,0.104,0.105,0.116,0.128,0.14,0.15,0.151,0.163,0.174,0.186,0.198,0.209,0.221,0.232,0.233,0.244,0.256,0.267,0.279,0.291,0.301,0.302,0.313],
"y": [0.651,0.667,0.683,0.7,0.702,0.717,0.733,0.75,0.767,0.783,0.785,0.8,0.802,0.817,0.833,0.85,0.852,0.867,0.868,0.883,0.885,0.9,0.902,0.917,0.918,0.933,0.935,0.935,0.935,0.935,0.95,0.951,0.951,0.951,0.951,0.951,0.951,0.951,0.967,0.967,0.967,0.967,0.967,0.967,0.968,0.983,0.985,1]
},
{
"x": [0.833,0.837,0.84,0.843,0.843,0.846,0.849,0.849,0.849,0.855,0.858,0.858,0.86,0.866,0.872,0.878,0.88,0.872,0.872,0.869,0.866,0.864,0.861,0.864,0.869,0.872,0.872,0.878,0.882,0.884,0.884,0.895,0.896,0.907,0.919,0.92,0.93,0.942,0.943,0.943,0.953,0.955,0.955,0.953,0.943,0.942,0.931,0.93,0.919,0.908,0.907,0.896,0.895,0.884,0.884,0.876,0.873,0.872,0.86,0.849,0.838,0.837,0.827,0.826,0.815,0.814,0.808,0.802,0.797,0.797,0.791,0.785,0.779,0.779,0.767,0.76,0.756,0.752,0.745,0.744,0.733,0.722,0.721,0.72,0.709,0.698,0.687,0.686,0.674,0.664,0.663,0.651,0.641,0.64,0.628,0.617,0.616,0.606,0.605,0.594,0.593,0.582,0.581,0.571,0.57,0.558,0.547,0.535,0.524,0.523,0.512,0.5,0.489,0.488,0.477,0.465,0.455,0.453,0.442,0.43,0.42,0.419,0.407,0.395,0.384,0.373],
"y": [0,0.008,0.017,0.033,0.05,0.067,0.082,0.083,0.1,0.117,0.133,0.15,0.158,0.167,0.175,0.183,0.2,0.217,0.218,0.233,0.25,0.267,0.283,0.3,0.317,0.332,0.333,0.35,0.367,0.382,0.383,0.399,0.4,0.416,0.416,0.417,0.432,0.432,0.433,0.45,0.465,0.467,0.483,0.485,0.5,0.502,0.517,0.517,0.522,0.533,0.534,0.55,0.551,0.567,0.567,0.583,0.6,0.601,0.606,0.608,0.617,0.618,0.633,0.635,0.65,0.652,0.667,0.672,0.683,0.7,0.706,0.717,0.733,0.734,0.742,0.75,0.758,0.767,0.783,0.784,0.794,0.8,0.801,0.8,0.797,0.796,0.8,0.801,0.802,0.817,0.817,0.818,0.833,0.834,0.835,0.85,0.852,0.867,0.868,0.883,0.885,0.9,0.902,0.917,0.918,0.917,0.918,0.925,0.933,0.934,0.935,0.935,0.95,0.951,0.951,0.952,0.967,0.968,0.968,0.968,0.983,0.985,0.985,0.985,0.985,1]
},
{
"x": [0.396,0.407,0.408,0.419,0.43,0.442,0.453,0.455,0.465,0.476,0.477,0.487,0.488,0.499],
"y": [0,0.015,0.017,0.025,0.025,0.028,0.033,0.033,0.042,0.033,0.032,0.017,0.015,0]
},
{
"x": [0.197,0.186,0.185,0.185,0.182,0.174,0.174,0.171,0.169,0.167,0.163,0.162,0.157,0.151,0.145,0.14,0.134,0.128,0.124,0.116,0.114,0.109,0.105,0.104,0.099,0.093,0.093,0.086,0.081,0.081,0.076,0.07,0.07,0.067,0.064,0.061,0.058,0.054,0.047,0.044,0.041,0.044,0.038,0.035,0.035,0.033,0.031,0.027,0.025,0.025,0.023,0.021,0.021,0.023,0.023,0.027,0.031,0.035,0.035,0.042,0.047,0.05,0.058,0.066,0.07,0.076,0.081,0.087,0.093,0.097,0.104,0.105,0.112,0.116,0.12,0.128,0.138,0.14,0.151,0.157,0.163,0.174,0.174,0.186,0.198,0.209,0.212,0.221,0.233,0.244,0.246,0.253,0.256,0.267,0.279,0.291,0.302,0.314,0.326,0.337,0.349,0.36,0.372,0.378,0.384,0.395,0.407,0.408,0.419,0.424,0.43,0.442,0.442,0.453,0.459,0.465,0.477,0.488,0.489,0.5,0.512,0.523,0.524,0.535,0.547,0.558,0.57,0.571,0.581,0.582,0.593,0.594,0.605,0.605,0.616,0.628,0.64,0.651,0.663,0.674,0.686,0.698,0.709,0.721,0.721,0.73,0.733,0.74,0.744,0.748,0.756,0.756,0.767,0.768,0.771,0.775,0.779,0.779,0.785,0.791,0.791,0.797,0.802,0.803,0.814,0.815,0.82,0.826,0.831,0.837,0.843,0.849,0.849,0.85,0.86,0.861,0.864,0.865,0.865,0.864,0.86,0.858,0.854,0.849,0.849,0.846,0.843,0.843,0.843,0.847,0.849,0.85,0.849,0.849,0.846,0.84,0.837,0.833,0.826,0.826,0.82,0.814,0.814,0.808,0.803,0.803,0.802,0.791,0.79,0.779,0.767,0.766,0.756,0.755,0.744,0.743,0.733,0.721,0.709,0.698,0.686,0.674,0.673,0.663,0.651,0.641,0.64,0.628,0.616,0.606,0.605,0.594,0.593,0.581,0.58,0.57,0.558,0.557,0.547,0.535,0.523,0.522,0.512,0.5,0.488,0.487,0.477,0.465,0.453,0.442,0.43,0.42,0.419,0.407,0.396,0.395,0.384,0.384,0.373,0.372,0.361,0.36,0.349,0.349,0.338,0.337,0.326,0.326,0.314,0.303],
"y": [0,0.016,0.017,0.033,0.05,0.066,0.067,0.083,0.1,0.117,0.132,0.133,0.15,0.158,0.167,0.175,0.183,0.192,0.2,0.211,0.217,0.233,0.249,0.25,0.267,0.283,0.283,0.3,0.316,0.317,0.333,0.349,0.35,0.367,0.383,0.4,0.408,0.417,0.428,0.433,0.45,0.467,0.483,0.498,0.5,0.517,0.533,0.55,0.567,0.583,0.592,0.6,0.617,0.633,0.634,0.65,0.667,0.683,0.684,0.7,0.711,0.717,0.725,0.733,0.739,0.75,0.758,0.767,0.778,0.783,0.8,0.801,0.817,0.825,0.833,0.844,0.85,0.851,0.862,0.867,0.871,0.883,0.884,0.884,0.887,0.896,0.9,0.91,0.912,0.915,0.917,0.933,0.936,0.936,0.936,0.936,0.936,0.939,0.94,0.943,0.947,0.943,0.938,0.933,0.931,0.925,0.917,0.917,0.906,0.9,0.894,0.884,0.883,0.872,0.867,0.861,0.856,0.851,0.85,0.835,0.834,0.834,0.833,0.818,0.818,0.818,0.817,0.817,0.802,0.8,0.785,0.783,0.767,0.767,0.756,0.751,0.751,0.75,0.751,0.756,0.758,0.762,0.757,0.75,0.75,0.733,0.728,0.717,0.708,0.7,0.684,0.683,0.667,0.667,0.65,0.633,0.618,0.617,0.6,0.585,0.583,0.567,0.552,0.55,0.535,0.533,0.517,0.508,0.5,0.492,0.483,0.468,0.467,0.45,0.435,0.433,0.417,0.4,0.383,0.367,0.356,0.35,0.333,0.317,0.316,0.3,0.283,0.267,0.25,0.233,0.225,0.217,0.2,0.198,0.183,0.167,0.158,0.15,0.133,0.132,0.117,0.1,0.098,0.083,0.067,0.05,0.049,0.048,0.05,0.065,0.065,0.067,0.082,0.083,0.098,0.1,0.115,0.116,0.116,0.116,0.115,0.116,0.117,0.122,0.125,0.117,0.116,0.115,0.115,0.1,0.098,0.083,0.082,0.082,0.083,0.098,0.098,0.1,0.115,0.115,0.116,0.117,0.132,0.132,0.133,0.133,0.148,0.148,0.149,0.148,0.148,0.133,0.133,0.132,0.117,0.116,0.1,0.099,0.083,0.083,0.067,0.066,0.05,0.049,0.033,0.033,0.017,0.016,0.011,0]
},
{
"x": [0.047,0.045,0.047,0.048,0.047,0.046,0.045,0.044,0.042,0.042,0.044,0.046,0.047,0.051,0.058,0.06,0.07,0.072,0.081,0.081,0.091,0.093,0.104,0.105,0.116,0.119,0.126,0.128,0.136,0.14,0.147,0.151,0.162,0.163,0.174,0.18,0.186,0.198,0.206,0.209,0.221,0.223,0.233,0.244,0.244,0.256,0.267,0.279,0.291,0.302,0.314,0.326,0.336,0.337,0.338,0.349,0.36,0.372,0.384,0.384,0.395,0.398,0.407,0.407,0.419,0.419,0.43,0.442,0.442,0.453,0.461,0.465,0.471,0.477,0.477,0.484,0.488,0.489,0.5,0.501,0.512,0.513,0.523,0.535,0.547,0.558,0.558,0.57,0.581,0.582,0.593,0.605,0.616,0.628,0.638,0.64,0.651,0.663,0.674,0.685,0.686,0.698,0.698,0.709,0.715,0.721,0.723,0.727,0.733,0.733,0.736,0.736,0.736,0.736,0.736,0.738,0.744,0.745,0.75,0.756,0.756,0.765,0.767,0.771,0.779,0.78,0.791,0.792,0.802,0.808,0.814,0.814,0.822,0.826,0.829,0.833,0.834,0.834,0.831,0.829,0.826,0.824,0.821,0.822,0.824,0.823,0.814,0.803,0.802,0.791,0.785,0.779,0.769,0.767,0.756,0.744,0.733,0.721,0.709,0.698,0.686,0.674,0.663,0.651,0.64,0.628,0.627,0.616,0.605,0.593,0.581,0.57,0.558,0.557,0.547,0.535,0.523,0.512,0.5,0.499,0.488,0.477,0.465,0.453,0.442,0.431,0.43,0.419,0.411,0.407,0.399,0.395,0.384,0.384,0.372,0.368,0.36,0.358,0.352,0.349,0.338,0.337,0.326,0.322,0.314,0.308,0.302,0.295,0.291,0.279,0.267,0.266,0.256,0.244,0.233,0.232,0.231,0.227,0.221,0.22,0.215,0.209,0.209,0.209,0.198,0.197,0.19,0.186,0.174,0.174,0.163,0.159,0.151,0.143,0.14,0.131,0.128,0.122,0.118,0.116,0.11,0.106,0.105,0.099,0.095,0.093,0.093,0.088,0.085,0.083,0.081,0.078,0.072,0.07,0.069,0.06,0.058,0.05,0.047],
"y": [0.511,0.517,0.525,0.533,0.548,0.55,0.567,0.583,0.6,0.617,0.633,0.65,0.651,0.667,0.679,0.683,0.697,0.7,0.717,0.717,0.733,0.737,0.75,0.75,0.762,0.767,0.783,0.789,0.8,0.806,0.817,0.821,0.833,0.834,0.846,0.85,0.853,0.86,0.867,0.869,0.881,0.883,0.891,0.9,0.9,0.907,0.911,0.911,0.91,0.911,0.912,0.914,0.917,0.917,0.917,0.914,0.911,0.907,0.9,0.9,0.889,0.883,0.867,0.867,0.851,0.85,0.844,0.834,0.833,0.825,0.817,0.808,0.8,0.785,0.783,0.767,0.752,0.75,0.735,0.733,0.718,0.717,0.702,0.701,0.706,0.717,0.717,0.717,0.717,0.717,0.708,0.708,0.711,0.712,0.717,0.717,0.722,0.727,0.729,0.733,0.734,0.734,0.733,0.721,0.717,0.706,0.7,0.683,0.667,0.667,0.65,0.633,0.617,0.6,0.583,0.567,0.552,0.55,0.533,0.518,0.517,0.5,0.492,0.483,0.467,0.467,0.451,0.45,0.442,0.433,0.418,0.417,0.4,0.392,0.383,0.367,0.35,0.333,0.317,0.3,0.289,0.283,0.267,0.25,0.233,0.217,0.204,0.2,0.199,0.189,0.183,0.175,0.167,0.166,0.161,0.161,0.158,0.158,0.154,0.154,0.157,0.158,0.16,0.163,0.164,0.166,0.167,0.172,0.172,0.178,0.178,0.183,0.183,0.183,0.189,0.189,0.194,0.199,0.199,0.2,0.204,0.204,0.208,0.208,0.207,0.2,0.2,0.192,0.183,0.178,0.167,0.162,0.15,0.15,0.138,0.133,0.122,0.117,0.1,0.096,0.083,0.083,0.072,0.067,0.056,0.05,0.044,0.033,0.029,0.028,0.033,0.033,0.042,0.049,0.049,0.05,0.067,0.083,0.098,0.1,0.117,0.132,0.133,0.15,0.166,0.167,0.183,0.189,0.199,0.2,0.211,0.217,0.225,0.233,0.238,0.25,0.254,0.267,0.283,0.288,0.3,0.317,0.321,0.333,0.35,0.365,0.367,0.383,0.4,0.417,0.425,0.433,0.45,0.465,0.467,0.483,0.487,0.5,0.511]
},
{
"x": [0.07,0.07,0.065,0.065,0.066,0.067,0.07,0.069,0.069,0.069,0.07,0.074,0.078,0.081,0.085,0.093,0.099,0.105,0.116,0.116,0.128,0.128,0.139,0.14,0.151,0.151,0.159,0.163,0.169,0.174,0.182,0.186,0.195,0.198,0.209,0.213,0.221,0.232,0.233,0.244,0.256,0.267,0.279,0.291,0.301,0.302,0.314,0.326,0.337,0.349,0.36,0.361,0.372,0.373,0.384,0.395,0.396,0.407,0.415,0.419,0.43,0.431,0.442,0.442,0.449,0.451,0.451,0.453,0.454,0.457,0.462,0.465,0.477,0.477,0.488,0.492,0.5,0.5,0.509,0.512,0.523,0.535,0.547,0.557,0.558,0.57,0.581,0.592,0.593,0.605,0.616,0.627,0.628,0.64,0.651,0.651,0.663,0.674,0.686,0.687,0.698,0.699,0.698,0.698,0.698,0.698,0.687,0.686,0.674,0.664,0.664,0.664,0.674,0.675,0.675,0.686,0.687,0.698,0.703,0.709,0.721,0.733,0.734,0.744,0.756,0.758,0.765,0.767,0.771,0.779,0.779,0.787,0.791,0.795,0.802,0.803,0.805,0.806,0.806,0.805,0.804,0.803,0.802,0.792,0.791,0.779,0.769,0.767,0.756,0.744,0.733,0.721,0.71,0.709,0.698,0.686,0.685,0.674,0.663,0.651,0.65,0.64,0.628,0.616,0.605,0.604,0.593,0.581,0.57,0.558,0.547,0.535,0.523,0.512,0.5,0.488,0.477,0.465,0.453,0.442,0.43,0.426,0.419,0.408,0.407,0.395,0.384,0.378,0.372,0.364,0.36,0.355,0.349,0.341,0.337,0.326,0.326,0.315,0.314,0.302,0.292,0.291,0.279,0.279,0.267,0.267,0.26,0.256,0.25,0.244,0.244,0.233,0.232,0.224,0.221,0.212,0.209,0.198,0.186,0.174,0.172,0.163,0.157,0.151,0.14,0.139,0.131,0.128,0.124,0.12,0.116,0.115,0.111,0.108,0.105,0.105,0.103,0.101,0.096,0.094,0.093,0.09,0.081,0.079,0.07],
"y": [0.5,0.5,0.517,0.533,0.55,0.567,0.583,0.6,0.617,0.633,0.635,0.65,0.667,0.675,0.683,0.694,0.7,0.704,0.717,0.717,0.733,0.734,0.75,0.751,0.767,0.767,0.783,0.789,0.8,0.808,0.817,0.821,0.833,0.836,0.846,0.85,0.856,0.867,0.867,0.87,0.875,0.88,0.88,0.881,0.883,0.884,0.888,0.888,0.887,0.886,0.884,0.883,0.867,0.867,0.86,0.85,0.85,0.839,0.833,0.83,0.817,0.817,0.8,0.8,0.783,0.767,0.75,0.735,0.733,0.717,0.7,0.694,0.684,0.683,0.672,0.667,0.651,0.65,0.633,0.628,0.628,0.625,0.628,0.633,0.634,0.639,0.642,0.65,0.651,0.656,0.652,0.667,0.667,0.667,0.683,0.684,0.684,0.684,0.684,0.683,0.668,0.667,0.65,0.633,0.617,0.616,0.6,0.599,0.598,0.583,0.567,0.55,0.535,0.533,0.517,0.501,0.5,0.492,0.483,0.478,0.475,0.467,0.467,0.461,0.456,0.45,0.433,0.425,0.417,0.401,0.4,0.383,0.375,0.367,0.351,0.35,0.333,0.317,0.3,0.283,0.267,0.25,0.248,0.233,0.233,0.222,0.217,0.216,0.213,0.211,0.206,0.206,0.2,0.199,0.199,0.2,0.2,0.208,0.208,0.216,0.217,0.222,0.228,0.233,0.233,0.233,0.239,0.239,0.239,0.239,0.239,0.239,0.239,0.242,0.244,0.244,0.246,0.246,0.25,0.246,0.238,0.233,0.225,0.217,0.216,0.213,0.206,0.2,0.194,0.183,0.175,0.167,0.161,0.15,0.144,0.133,0.133,0.117,0.116,0.106,0.1,0.099,0.099,0.1,0.116,0.117,0.133,0.142,0.15,0.165,0.167,0.183,0.183,0.2,0.204,0.217,0.219,0.227,0.229,0.231,0.233,0.242,0.25,0.258,0.266,0.267,0.283,0.29,0.3,0.317,0.329,0.333,0.35,0.367,0.383,0.383,0.4,0.417,0.433,0.45,0.456,0.467,0.481,0.483,0.5]
},
{
"x": [0.093,0.089,0.088,0.091,0.091,0.093,0.093,0.094,0.097,0.101,0.105,0.107,0.112,0.116,0.119,0.124,0.128,0.131,0.14,0.145,0.151,0.157,0.163,0.167,0.174,0.178,0.186,0.19,0.198,0.202,0.209,0.221,0.225,0.233,0.244,0.248,0.256,0.267,0.279,0.279,0.291,0.302,0.314,0.326,0.337,0.349,0.355,0.36,0.372,0.381,0.384,0.395,0.401,0.407,0.416,0.419,0.422,0.426,0.429,0.43,0.434,0.434,0.436,0.439,0.442,0.442,0.453,0.461,0.465,0.477,0.477,0.485,0.488,0.5,0.5,0.512,0.512,0.523,0.535,0.547,0.558,0.57,0.576,0.581,0.593,0.594,0.605,0.605,0.61,0.616,0.617,0.628,0.628,0.636,0.64,0.651,0.652,0.663,0.674,0.686,0.698,0.698,0.709,0.721,0.722,0.733,0.744,0.745,0.756,0.756,0.756,0.757,0.757,0.767,0.768,0.767,0.757,0.756,0.756,0.745,0.744,0.733,0.721,0.709,0.708,0.698,0.686,0.685,0.674,0.663,0.651,0.64,0.628,0.616,0.605,0.593,0.581,0.57,0.558,0.557,0.547,0.535,0.523,0.512,0.5,0.488,0.477,0.465,0.455,0.453,0.442,0.43,0.419,0.408,0.407,0.395,0.384,0.373,0.372,0.366,0.36,0.353,0.349,0.341,0.337,0.326,0.32,0.314,0.308,0.302,0.291,0.279,0.273,0.267,0.256,0.255,0.244,0.24,0.233,0.221,0.221,0.209,0.198,0.192,0.186,0.174,0.163,0.163,0.151,0.149,0.14,0.139,0.134,0.13,0.13,0.128,0.126,0.123,0.12,0.116,0.116,0.109,0.105,0.105,0.103,0.098,0.093],
"y": [0.494,0.5,0.517,0.533,0.55,0.567,0.568,0.583,0.6,0.617,0.625,0.633,0.65,0.658,0.667,0.683,0.694,0.7,0.71,0.717,0.725,0.733,0.742,0.75,0.762,0.767,0.778,0.783,0.794,0.8,0.807,0.814,0.817,0.825,0.831,0.833,0.84,0.845,0.85,0.85,0.855,0.861,0.863,0.86,0.86,0.853,0.85,0.848,0.84,0.833,0.831,0.822,0.817,0.81,0.8,0.792,0.783,0.767,0.75,0.744,0.733,0.717,0.7,0.683,0.668,0.667,0.658,0.65,0.646,0.634,0.633,0.617,0.611,0.6,0.6,0.584,0.583,0.572,0.572,0.572,0.572,0.572,0.567,0.561,0.551,0.55,0.535,0.533,0.517,0.502,0.5,0.484,0.483,0.467,0.458,0.451,0.45,0.435,0.435,0.434,0.434,0.433,0.417,0.417,0.417,0.402,0.401,0.4,0.384,0.383,0.367,0.35,0.333,0.318,0.317,0.315,0.3,0.283,0.282,0.267,0.266,0.266,0.266,0.266,0.267,0.282,0.283,0.283,0.298,0.298,0.299,0.299,0.299,0.294,0.289,0.289,0.289,0.292,0.299,0.3,0.303,0.306,0.311,0.311,0.316,0.316,0.311,0.306,0.3,0.299,0.289,0.289,0.288,0.283,0.283,0.283,0.278,0.267,0.265,0.25,0.244,0.233,0.228,0.217,0.211,0.204,0.2,0.192,0.183,0.175,0.175,0.175,0.183,0.187,0.199,0.2,0.21,0.217,0.224,0.233,0.233,0.245,0.248,0.25,0.254,0.26,0.266,0.267,0.281,0.283,0.3,0.3,0.317,0.333,0.35,0.358,0.367,0.383,0.4,0.416,0.417,0.433,0.449,0.45,0.467,0.483,0.494]
},
{
"x": [0.326,0.323,0.326,0.327,0.337,0.348,0.349,0.352,0.349,0.343,0.337,0.331,0.326],
"y": [0.542,0.55,0.565,0.567,0.575,0.567,0.565,0.55,0.542,0.533,0.529,0.533,0.542]
},
{
"x": [0.116,0.114,0.11,0.108,0.109,0.11,0.109,0.109,0.116,0.116,0.123,0.128,0.13,0.134,0.138,0.14,0.147,0.151,0.163,0.163,0.172,0.174,0.181,0.186,0.195,0.198,0.206,0.209,0.221,0.221,0.233,0.237,0.244,0.255,0.256,0.267,0.279,0.291,0.301,0.302,0.314,0.326,0.337,0.345,0.349,0.36,0.366,0.372,0.384,0.384,0.395,0.396,0.407,0.407,0.409,0.414,0.414,0.413,0.411,0.41,0.419,0.419,0.43,0.434,0.442,0.448,0.453,0.457,0.465,0.466,0.477,0.477,0.485,0.488,0.489,0.494,0.5,0.512,0.523,0.535,0.541,0.547,0.558,0.57,0.57,0.581,0.582,0.585,0.59,0.593,0.594,0.597,0.599,0.601,0.601,0.594,0.593,0.59,0.587,0.581,0.57,0.558,0.552,0.547,0.535,0.523,0.523,0.512,0.5,0.488,0.478,0.477,0.465,0.454,0.453,0.442,0.43,0.419,0.407,0.395,0.384,0.373,0.372,0.361,0.36,0.349,0.349,0.338,0.337,0.326,0.326,0.314,0.303,0.302,0.291,0.279,0.267,0.256,0.253,0.244,0.24,0.233,0.225,0.221,0.209,0.209,0.198,0.186,0.174,0.163,0.163,0.151,0.15,0.149,0.148,0.145,0.141,0.14,0.138,0.135,0.13,0.128,0.128,0.119,0.116],
"y": [0.475,0.483,0.5,0.517,0.533,0.55,0.567,0.583,0.6,0.601,0.617,0.628,0.633,0.65,0.667,0.672,0.683,0.687,0.7,0.7,0.717,0.721,0.733,0.74,0.75,0.754,0.767,0.77,0.783,0.784,0.794,0.8,0.808,0.817,0.817,0.819,0.825,0.831,0.833,0.834,0.834,0.835,0.838,0.833,0.831,0.822,0.817,0.811,0.8,0.8,0.784,0.783,0.767,0.767,0.75,0.733,0.717,0.7,0.683,0.667,0.651,0.65,0.638,0.633,0.622,0.617,0.608,0.6,0.584,0.583,0.567,0.567,0.55,0.535,0.533,0.517,0.508,0.506,0.501,0.508,0.517,0.522,0.525,0.518,0.517,0.501,0.5,0.483,0.467,0.452,0.45,0.433,0.417,0.4,0.383,0.367,0.365,0.35,0.333,0.329,0.329,0.33,0.333,0.337,0.343,0.35,0.35,0.361,0.356,0.354,0.35,0.35,0.343,0.333,0.333,0.333,0.333,0.333,0.333,0.329,0.323,0.317,0.316,0.3,0.3,0.283,0.283,0.267,0.266,0.25,0.249,0.238,0.233,0.233,0.233,0.233,0.229,0.23,0.233,0.246,0.25,0.258,0.267,0.27,0.283,0.283,0.292,0.296,0.3,0.3,0.3,0.313,0.317,0.333,0.35,0.367,0.383,0.392,0.4,0.417,0.433,0.448,0.45,0.467,0.475]
},
{
"x": [0.302,0.295,0.294,0.291,0.291,0.295,0.299,0.302,0.31,0.314,0.326,0.337,0.349,0.355,0.36,0.368,0.372,0.374,0.378,0.381,0.38,0.372,0.372,0.363,0.36,0.349,0.337,0.326,0.314,0.303,0.302],
"y": [0.501,0.517,0.533,0.55,0.567,0.583,0.6,0.606,0.617,0.621,0.622,0.623,0.619,0.617,0.611,0.6,0.592,0.583,0.567,0.55,0.533,0.517,0.517,0.5,0.494,0.488,0.484,0.484,0.489,0.5,0.501]
},
{
"x": [0.14,0.139,0.134,0.132,0.134,0.134,0.137,0.14,0.142,0.149,0.151,0.155,0.163,0.169,0.174,0.182,0.186,0.194,0.198,0.203,0.209,0.212,0.221,0.224,0.233,0.235,0.244,0.25,0.256,0.267,0.279,0.279,0.291,0.302,0.313,0.314,0.326,0.337,0.341,0.349,0.355,0.36,0.366,0.372,0.374,0.379,0.384,0.384,0.391,0.391,0.391,0.388,0.384,0.384,0.384,0.372,0.371,0.36,0.349,0.337,0.336,0.326,0.314,0.303,0.302,0.291,0.283,0.279,0.273,0.268,0.267,0.265,0.264,0.264,0.264,0.265,0.267,0.27,0.279,0.279,0.288,0.291,0.302,0.308,0.314,0.326,0.337,0.349,0.359,0.36,0.372,0.378,0.384,0.388,0.395,0.395,0.404,0.407,0.407,0.407,0.407,0.419,0.419,0.43,0.431,0.442,0.443,0.453,0.465,0.469,0.47,0.471,0.474,0.477,0.477,0.477,0.477,0.474,0.469,0.465,0.454,0.453,0.442,0.43,0.42,0.419,0.407,0.395,0.384,0.373,0.372,0.36,0.352,0.349,0.341,0.337,0.329,0.326,0.314,0.308,0.302,0.291,0.279,0.267,0.256,0.255,0.244,0.233,0.221,0.221,0.209,0.202,0.198,0.186,0.185,0.174,0.174,0.163,0.163,0.161,0.159,0.157,0.155,0.151,0.151,0.148,0.144,0.141,0.14],
"y": [0.515,0.517,0.533,0.55,0.567,0.583,0.6,0.608,0.617,0.633,0.642,0.65,0.658,0.667,0.675,0.683,0.689,0.7,0.706,0.717,0.728,0.733,0.746,0.75,0.762,0.767,0.779,0.783,0.787,0.793,0.8,0.8,0.807,0.814,0.817,0.817,0.817,0.819,0.817,0.806,0.8,0.794,0.783,0.772,0.767,0.75,0.734,0.733,0.717,0.7,0.683,0.667,0.65,0.633,0.633,0.633,0.633,0.639,0.647,0.65,0.65,0.653,0.654,0.65,0.65,0.64,0.633,0.628,0.617,0.6,0.598,0.583,0.567,0.55,0.533,0.517,0.508,0.5,0.484,0.483,0.467,0.462,0.454,0.45,0.447,0.442,0.438,0.446,0.45,0.45,0.461,0.467,0.475,0.483,0.5,0.501,0.517,0.533,0.55,0.567,0.567,0.567,0.567,0.551,0.55,0.534,0.533,0.529,0.522,0.517,0.5,0.483,0.467,0.452,0.45,0.433,0.432,0.417,0.4,0.394,0.383,0.383,0.375,0.371,0.367,0.366,0.366,0.363,0.357,0.35,0.35,0.343,0.333,0.328,0.317,0.311,0.3,0.297,0.288,0.283,0.279,0.278,0.275,0.278,0.283,0.283,0.292,0.297,0.3,0.3,0.31,0.317,0.322,0.333,0.333,0.349,0.35,0.366,0.367,0.383,0.4,0.417,0.433,0.449,0.45,0.467,0.483,0.5,0.515]
},
{
"x": [0.395,0.395,0.395,0.396,0.395],
"y": [0.599,0.6,0.602,0.6,0.599]
},
{
"x": [0.535,0.534,0.534,0.534,0.535,0.546,0.547,0.558,0.559,0.57,0.57,0.57,0.57,0.57,0.57,0.559,0.558,0.557,0.547,0.545,0.535],
"y": [0.398,0.4,0.417,0.433,0.434,0.45,0.451,0.452,0.45,0.434,0.433,0.417,0.4,0.383,0.383,0.367,0.366,0.367,0.382,0.383,0.398]
},
{
"x": [0.163,0.163,0.158,0.154,0.156,0.157,0.158,0.163,0.163,0.171,0.174,0.174,0.186,0.189,0.197,0.198,0.207,0.209,0.218,0.221,0.23,0.233,0.241,0.244,0.255,0.256,0.267,0.279,0.29,0.291,0.302,0.314,0.315,0.326,0.337,0.338,0.349,0.349,0.349,0.349,0.337,0.327,0.326,0.325,0.314,0.302,0.291,0.28,0.279,0.267,0.265,0.262,0.256,0.256,0.254,0.251,0.249,0.248,0.248,0.247,0.247,0.248,0.25,0.253,0.256,0.265,0.267,0.27,0.279,0.28,0.291,0.302,0.303,0.314,0.326,0.327,0.327,0.327,0.326,0.315,0.314,0.303,0.302,0.291,0.279,0.267,0.256,0.25,0.244,0.233,0.227,0.221,0.209,0.198,0.194,0.186,0.186,0.178,0.174,0.174,0.173,0.172,0.17,0.167,0.163],
"y": [0.498,0.5,0.517,0.533,0.55,0.567,0.583,0.6,0.601,0.617,0.633,0.634,0.644,0.65,0.667,0.667,0.683,0.688,0.7,0.704,0.717,0.721,0.733,0.737,0.75,0.75,0.752,0.752,0.767,0.767,0.767,0.768,0.767,0.751,0.751,0.75,0.735,0.733,0.717,0.715,0.715,0.7,0.699,0.7,0.716,0.716,0.715,0.7,0.699,0.698,0.683,0.667,0.65,0.648,0.633,0.617,0.6,0.583,0.567,0.55,0.533,0.517,0.5,0.483,0.479,0.467,0.458,0.45,0.434,0.433,0.422,0.417,0.417,0.402,0.402,0.4,0.383,0.367,0.365,0.35,0.348,0.333,0.333,0.333,0.328,0.328,0.329,0.333,0.339,0.346,0.35,0.353,0.361,0.363,0.367,0.383,0.383,0.4,0.415,0.417,0.433,0.45,0.467,0.483,0.498]
},
{
"x": [0.419,0.418,0.418,0.419,0.429,0.429,0.43,0.442,0.442,0.443,0.443,0.442,0.431,0.43,0.419],
"y": [0.416,0.417,0.433,0.435,0.45,0.467,0.468,0.468,0.467,0.45,0.433,0.432,0.417,0.416,0.416]
},
{
"x": [0.198,0.197,0.197,0.192,0.197,0.197,0.198,0.209,0.209,0.209,0.221,0.221,0.233,0.233,0.233,0.233,0.234,0.233,0.233,0.233,0.229,0.228,0.23,0.233,0.233,0.234,0.235,0.24,0.244,0.245,0.245,0.256,0.256,0.256,0.245,0.244,0.243,0.233,0.231,0.221,0.22,0.209,0.209,0.205,0.202,0.201,0.201,0.202,0.198],
"y": [0.532,0.533,0.55,0.567,0.583,0.6,0.601,0.617,0.633,0.634,0.65,0.651,0.652,0.65,0.633,0.617,0.6,0.583,0.567,0.565,0.55,0.533,0.517,0.502,0.5,0.483,0.467,0.45,0.435,0.433,0.417,0.402,0.4,0.399,0.383,0.383,0.383,0.398,0.4,0.415,0.417,0.433,0.433,0.45,0.467,0.483,0.5,0.517,0.532]
}];
const width = 805;
const height = 562;
const x = d3.scale.linear()
.domain([0, 1])
.range([0, width]);
const y = d3.scale.linear()
.domain([0, 1])
.range([height, 0]);
const line = d3.svg.line()
.x((d) => x(d.x))
.y((d) => y(d.y));
const svg = d3.select('.contourmap').append('svg')
.attr('width', width)
.attr('height', height)
.style('border', '5px solid #6d6e71')
.selectAll('path')
.data(data.map((d) => d3.range(d.x.length).map(function(i) { return {x: d.x[i], y: d.y[i]}; })))
.enter().append('svg:path')
.attr('d', line)
.on('mouseover', function() {
d3.select(this).style('stroke', '#dedede');
})
.on('mouseout', function() {
d3.select(this).style('stroke', '#3e3e3e');
})
.style('fill', 'none')
.style('stroke', '#3e3e3e')
.style('stroke-width', 0)
.transition()
.duration(5000)
.style('stroke-width', 2);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment