Skip to content

Instantly share code, notes, and snippets.

@ienwhang
Created March 29, 2018 21:52
Show Gist options
  • Save ienwhang/57ae7177c3659ce85c08ffa77770f96b to your computer and use it in GitHub Desktop.
Save ienwhang/57ae7177c3659ce85c08ffa77770f96b to your computer and use it in GitHub Desktop.
AS4 Trellis Plot D3
Coal CommercialGeothermal CommercialHydropower CommercialSolar CommercialWind CommercialWood ConsumptionCommercialCoal ConsumptionCommercialDistillateFuelOil ConsumptionCommercialKerosene ConsumptionCommercialLiquefiedPetroleumGases ConsumptionCommercialNaturalGas ConsumptionElectricPowerCoal ConsumptionElectricPowerDistillateFuelOil ConsumptionElectricPowerNaturalGas ConsumptionIndustrialCoal ConsumptionIndustrialDistillateFuelOil ConsumptionIndustrialKerosene ConsumptionIndustrialLiquefiedPetroleumGases ConsumptionIndustrialNaturalGas ConsumptionIndustrialOtherPetroleumProducts ConsumptionResidentialCoal ConsumptionResidentialDistillateFuelOil ConsumptionResidentialKerosene ConsumptionResidentialLiquefiedPetroleumGases ConsumptionResidentialNaturalGas ConsumptionResidentialWood ConsumptionTransportationCoal ConsumptionTransportationDistillateFuelOil ConsumptionTransportationLiquefiedPetroleumGases ConsumptionTransportationNaturalGas ElectricPowerWood ExpenditureCommercialCoal ExpenditureCommercialDistillateFuelOil ExpenditureCommercialKerosene ExpenditureCommercialLiquefiedPetroleumGases ExpenditureCommercialNaturalGas ExpenditureElectricPowerCoal ExpenditureElectricPowerDistillateFuelOil ExpenditureElectricPowerNaturalGas ExpenditureIndustrialCoal ExpenditureIndustrialDistillateFuelOil ExpenditureIndustrialKerosene ExpenditureIndustrialLiquefiedPetroleumGases ExpenditureIndustrialNaturalGas ExpenditureIndustrialOtherPetroleumProducts ExpenditureResidentialCoal ExpenditureResidentialDistillateFuelOil ExpenditureResidentialKerosene ExpenditureResidentialLiquefiedPetroleumGases ExpenditureResidentialNaturalGas ExpenditureResidentialWood ExpenditureTransportationCoal ExpenditureTransportationDistillateFuelOil ExpenditureTransportationLiquefiedPetroleumGases ExpenditureTransportationNaturalGas IndustrialGeothermal IndustrialHydropower IndustrialSolar IndustrialWind IndustrialWood PriceCommercialCoal PriceCommercialDistillateFuelOil PriceCommercialKerosene PriceCommercialLiquefiedPetroleumGases PriceCommercialNaturalGas PriceElectricPowerCoal PriceElectricPowerDistillateFuelOil PriceElectricPowerNaturalGas PriceIndustrialCoal PriceIndustrialDistillateFuelOil PriceIndustrialKerosene PriceIndustrialLiquefiedPetroleumGases PriceIndustrialNaturalGas PriceIndustrialOtherPetroleumProducts PriceTransportationCoal PriceTransportationDistillateFuelOil PriceTransportationLiquefiedPetroleumGases PriceTransportationNaturalGas RefineryCoal RefineryDistillateFuelOil RefineryLiquefiedPetroleumGases RefineryNaturalGas ResidentialGeothermal State Year
35 0 0 0 0 0 479 64 3710 259 4381 112672 0 700 334297 35160 58992 5423 17610 466332 153926 92 2825 84 12667 377572 25267 587 89200 819 10953 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 56347 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1960
86 0 0 0 0 0 465 55 3402 875 4436 116721 0 678 410443 58714 61992 4981 18033 472141 150719 79 2591 284 12824 388749 24458 258 92174 687 12120 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 58583 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1961
137 0 0 0 0 0 446 57 3055 620 5066 128672 0 500 410638 39389 60572 4824 20098 497738 152440 82 2326 202 14646 430026 23495 153 107487 809 16349 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 62711 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1962
188 0 0 0 0 0 434 36 2908 414 5492 134124 0 458 460019 45876 64793 4473 21617 569800 141394 50 2214 135 15877 444928 22928 166 117241 843 14498 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 69660 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1963
239 0 0 0 0 0 433 68 3499 436 5741 152042 0 502 555604 53370 76930 5042 20406 592088 154259 94 2665 142 16597 499736 22824 191 121027 764 17770 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 74975 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1964
290 0 0 0 0 0 410 111 3264 537 5910 175470 0 486 528668 63237 75736 3923 20023 567432 162467 147 2486 175 17085 524855 21655 199 122513 800 16789 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 74751 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1965
341 0 0 0 0 0 401 137 3460 507 4551 183263 0 565 639628 51052 83086 4240 21444 595393 167358 181 2635 165 13158 531915 21173 145 129024 673 32107 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78088 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1966
392 0 0 0 0 0 427 128 3549 1040 5379 197923 0 529 621709 53530 80853 3126 21762 649647 155987 169 2703 338 15551 559715 22257 122 134232 865 19740 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78398 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1967
443 0 0 0 0 0 432 98 3390 1892 5402 203006 0 554 731533 56671 63012 890 25190 681344 176825 124 2582 615 15619 553353 22601 117 155257 920 18023 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 86550 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1968
494 0 0 0 0 0 446 993 3559 2524 5905 221134 0 576 630224 57683 50064 1242 33125 719151 189692 1264 2710 821 17072 600914 23530 91 169639 854 18461 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 91831 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 California 1969
545 0 0 0 0 0 455 1055 3825 2892 5993 221282 0 621 670629 59327 49569 1861 34176 749134 195667 1343 2913 940 17326 582381 24183 86 171534 1172 17870 0 0.7 4.3 2.3 8.1 152.9 0 0.2 220.1 25.8 31.2 1.5 41.1 209.3 54.5 1.8 3.7 2.4 45.5 544.3 6.2 0.1 243.7 1.6 0 0 0 0 0 91693 0.63 1.12 0.78 1.35 0.69 0 0.36 0.33 0.43 0.68 0.78 1.38 0.38 1.6 0.63 1.42 1.35 0 0 3746 4435 107248 0 California 1970
596 0 0 0 0 0 465 35 4516 3072 6265 252628 0 1314 593220 50886 58559 1843 35091 734720 192133 34 3439 999 18113 665072 24716 59 208201 1431 19685 0 0 5.3 2.5 9 181.6 0 0.8 204.9 23.8 39.1 1.5 42.8 225.9 59.3 0 4.6 2.7 46.4 652.4 6.7 0 324.2 2.1 0 0 0 0 0 93620 0.53 1.18 0.8 1.44 0.72 0 0.59 0.35 0.47 0.7 0.8 1.48 0.42 1.55 0.53 1.56 1.44 0 0 2628 6165 111852 0 California 1971
647 0 0 0 0 0 459 48 4924 3535 5359 243328 0 -84 643350 47326 69658 1808 43189 727471 207243 36 3750 1149 15494 669746 24252 43 190211 1619 19664 0 0 5.8 2.9 7.9 188.1 0 -0.1 242.3 24.4 47 1.5 41.7 244.4 62.8 0 5.1 3.5 42.4 687.6 6.6 0 282.8 2.4 0 0 0 0 0 102615 0.61 1.18 0.81 1.48 0.77 0 0.76 0.38 0.52 0.71 0.81 1.53 0.45 1.64 0.61 1.49 1.48 0 0 3213 15885 109877 0 California 1972
698 0 0 0 0 0 431 0 5850 2313 5001 244510 0 713 483769 66913 82722 2140 49745 758265 218476 0 4455 752 14459 646764 22756 43 208394 1444 20735 0 0 8.3 2.5 7.9 198 0 0.8 203.2 40.6 73.8 2.3 62.3 283.6 70.3 0 7 2.7 53.9 714.8 7.1 0 370.9 2.3 0 0 0 0 0 106674 0 1.41 1.09 1.59 0.81 0 1.08 0.42 0.61 0.94 1.09 1.65 0.51 1.86 0.59 1.78 1.59 0 0 4444 12002 123042 0 California 1973
749 0 0 0 0 0 443 20 4162 3817 4649 241376 0 412 312294 60613 62233 6503 55777 752062 217667 9 3169 1241 13442 611387 23409 28 185016 1526 20021 0 0 9.9 8.6 11.3 227.2 0 0.8 183.3 78.1 112.7 14.7 110.3 361.8 96.7 0 7.9 6.6 59 800.4 11.3 0 541.8 3.7 0 0 0 0 0 110665 1.02 2.37 2.26 2.42 0.94 0 1.86 0.59 1.29 1.96 2.26 2.53 0.65 2.42 1.02 2.93 2.42 0 0 4694 12209 123856 0 California 1974
800 0 0 0 0 0 521 0 3768 3685 3141 253678 0 865 291860 56397 61273 6613 57189 703650 213954 0 2869 1198 9080 666718 27486 8 177824 1498 21411 0 0 9.8 9.2 8.4 309.6 0 2 305.2 74.6 126.2 16.5 116.1 539.6 110.1 0 8 6.1 40.4 993.8 13.9 0 573.4 4 0 0 0 0 0 99278 0 2.6 2.5 2.69 1.22 0 2.36 1.05 1.32 2.21 2.5 2.83 1.05 2.83 0.92 3.22 2.69 0 0 4175 16129 101233 0 California 1975
851 0 0 0 0 0 552 0 4810 3535 2926 231138 0 1685 313004 66625 64867 6515 57131 658420 234786 0 3663 1149 8459 630446 29223 5 191817 1676 16710 0 0 13.9 10.1 8.5 349.1 0 4.5 487.3 95.2 152.4 18.5 137.8 654.4 133.7 0 11.4 6 39.1 1061.9 15.8 0 636.1 4.9 0 0 0 0 0 114793 0 2.9 2.84 2.91 1.51 0 2.64 1.56 1.43 2.45 2.84 3.07 1.39 2.98 1.16 3.32 2.91 0 0 2659 12256 105310 0 California 1976
902 0 0 0 0 0 623 0 5642 5369 2677 238970 0 834 380235 75105 77797 8836 50642 660400 258151 0 4297 1746 7740 568934 32835 4 212902 1836 15646 0 0 16.9 15.9 9.4 471.7 0 2.2 797.4 110.4 193.3 26.2 148.4 872.8 147.1 0 13.8 10 42.3 1022.2 20.1 0 703.4 6.4 0 0 0 0 0 118233 0 3 2.97 3.51 1.97 0 2.69 2.1 1.47 2.6 2.97 3.75 1.86 3.14 1.26 3.3 3.51 0 0 3336 11018 106687 0 California 1977
953 0 0 0 0 0 683 68 6016 5936 4470 232861 0 8382 320297 67804 88521 10085 51833 512591 271187 20 4582 1930 12924 565126 35879 0 243245 2221 15457 0 0.1 18.3 18.5 17.7 497 0 23.5 698.6 107.5 230.8 31.4 168.2 721.6 159.6 0.1 15 11.7 65.5 1066.8 23.2 0 803.3 8.8 0 0 0 0 0 123530 1.4 3.04 3.11 3.97 2.13 0 2.8 2.18 1.59 2.66 3.11 4.25 2.04 3.03 0 3.3 3.97 0 0 1836 12276 86265 0 California 1978
1004 0 0 0 0 0 802 67 8241 1378 5796 270890 0 12288 469054 68481 121472 17594 59991 522600 284759 17 6276 448 16756 619069 42295 0 241251 3023 18738 0 0.1 36.1 5.9 23.3 706.4 0 45.9 1148.7 115.8 444.7 75.9 210.7 962.9 239.1 0.1 28.1 3.9 112.8 1458.5 39.3 0 1188.7 12.1 0 0 0 0 0 125182 1.6 4.38 4.31 4.01 2.61 0 3.73 2.45 1.69 3.81 4.31 4.23 2.61 5.11 0 4.93 4.01 0 0 4615 10182 84167 0 California 1979
1055 0 0 0 0 0 1315 73 18785 1259 5706 269401 0 9215 545786 66077 90729 10643 46822 507360 258105 19 550 102 16495 552411 52983 0 243488 2003 15922 0 0.1 124 8 28.5 1027.9 0 53.4 1925 126.4 489.1 67.9 191.9 1248.7 403.5 0.1 3.8 1.3 134.4 1861.6 68.6 0 1720.6 10 0 0 0 0 0 61101 1.82 6.6 6.38 4.99 3.82 0 5.79 3.53 1.91 5.49 6.38 5.27 3.64 8.56 0 7.07 4.99 0 0 1659 10370 98970 0 California 1980
1106 0 0 0 0 0 1572 38 21745 3130 5094 247379 0 6129 691377 78354 103305 2625 39077 482940 173761 8 418 403 14726 509933 65371 0 261723 4152 15745 0 0.1 164 22.8 29.5 1037.2 0 45.7 2760 169.2 659.9 19.1 185.1 1347.9 338 0 3.3 6.2 110.9 1824.2 104.1 0 2130.1 24 0 0 0 0 0 61177 2.06 7.54 7.27 5.79 4.19 0 7.45 3.99 2.16 6.42 7.27 6.18 3.88 9.79 0 8.14 5.79 0 0 460 9130 79769 0 California 1981
1157 0 0 0 0 0 1346 39 25613 1837 5146 247337 0 1825 562125 69368 120550 1089 35861 379674 181016 8 418 102 14878 562517 59416 0 243405 3770 13516 0 0.1 191.7 12.7 34 1256.1 0 12.2 2823.6 151.9 751.9 7.5 204.4 1422.5 300.4 0 3.3 1.6 148.7 2384.7 91.8 0 1939.1 24.9 0 0 0 0 0 57893 2.31 7.49 6.89 6.61 5.08 0 6.71 5.02 2.19 6.27 6.89 7.12 4.66 9.18 0 7.97 6.61 0 0 604 7140 51045 0 California 1982
1208 0 0 0 0 0 1647 39 39899 644 6080 224734 0 1338 487389 31976 99611 673 31701 359316 317405 7 740 307 17579 518959 72596 0 255052 4447 10642 0 0.1 250.1 5.4 41.6 1367.2 0 8.8 2474 75.6 637.3 4.8 169.6 1499.2 339.6 0 5.9 2.6 193.4 2698.7 108.6 0 1818.9 30.4 0 0 0 0 0 64538 2.37 6.27 8.39 6.84 6.08 0 6.57 5.08 2.37 6.47 7.12 7.39 5.28 9.12 0 7.13 6.84 0 0 1159 8764 51968 0 California 1983
1259 0 0 0 0 0 1994 637 46776 1297 5119 199093 0 1531 601651 36456 116782 2606 48785 437281 312400 149 868 510 14798 490008 88859 0 273346 6587 11800 0 1.5 280.9 10.8 34.2 1333.6 0 9.1 3060.6 87.1 720.7 18 267.9 1781.3 428.9 0.7 6.7 4.2 142.7 2755.4 135.2 0 1896.8 44 0 0 0 0 0 64118 2.39 6 8.29 6.68 6.7 0 5.95 5.09 2.39 6.29 6.89 7.23 5.01 9.38 0 6.94 6.68 0 0 2226 11729 55533 0 California 1984
1310 852 0 0 0 0 2175 974 19899 2000 6205 212934 0 1793 700254 44016 103560 2783 46022 449515 304559 275 839 412 17940 547793 91534 0 290618 4699 14960 0 2.2 118 22.3 58.9 1359.7 0 10.2 3130.1 99 636.7 19.2 359.5 1745.8 355.7 1.2 4.4 4.6 155.4 3016.1 133.9 0 2006.4 47.7 0 0 0 0 0 62819 2.25 5.93 11.15 9.5 6.39 0 5.69 4.47 2.25 6.19 6.9 10.27 4.54 8.79 0 6.9 10.16 0 0 623 11020 38951 0 California 1985
1361 0 0 0 0 0 2447 0 33412 638 4773 189475 0 2026 464216 42519 88746 1106 51517 443285 285862 0 1416 1040 13798 481277 83378 0 309339 3573 12793 0 0 117.6 3.2 42.8 1070.4 0 9.7 1304.4 96.1 326.5 5.3 348.1 1252.1 227.8 0 10.7 5.2 151.1 2384.7 97.8 0 1833.2 34.5 0 0 0 0 0 38965 0 3.52 4.97 8.97 5.65 0 4.79 2.81 2.26 3.84 4.8 9.58 3.46 10.42 0 5.93 9.66 0 0 3825 15189 57596 0 California 1986
1412 552 0 0 0 0 3768 11 33967 953 6092 218444 0 2041 667782 44937 90237 2467 55310 570725 285788 3 1408 464 17611 516573 110781 0 270737 3218 19439 0 0 140.8 4.5 51.6 1153.9 0 8.4 1670.1 94 387.3 11.8 379.4 1637.5 251.2 0 8.5 2.2 217.8 2648.3 123.8 0 1813.5 29.5 0 0 0 0 0 38142 2.09 4.15 4.69 8.46 5.28 0 4.1 2.5 2.09 4.42 4.8 8.99 3.39 10.52 0 6.7 9.18 0 0 2571 13097 60386 0 California 1987
1463 648 0 0 0 0 4157 113 34232 497 6726 255548 0 972 572844 50679 92878 207 54348 500801 324740 32 1236 573 19445 511451 118227 0 348064 3461 19747 0 0.2 130.8 2.5 57.2 1162.5 0 3.9 1621.7 98.3 369.9 1 352.2 1557.2 208.1 0.1 7.2 2.9 221.5 2803.9 133.5 0 2267.1 31.9 0 0 0 0 0 39328 1.94 3.82 5.07 8.51 4.55 0 4.03 2.83 1.94 4.07 4.97 9.05 3.65 9.91 0 6.51 9.22 0 0 2019 15450 51294 0 California 1988
1514 492 308 0 0 0 9682 194 27198 234 7271 269368 8508 1963 675485 57673 95876 243 59827 548403 308368 52 1419 613 21021 534620 119526 0 342518 3403 19963 19769 0.4 130 1.3 55.8 1264.2 13.2 7.1 1975.1 111.1 474.9 1.3 349 1712.8 216.1 0.2 10.8 3.3 244.8 2873.3 149 0 2444.7 28.7 0 480 0 0 0 61048 1.93 4.78 5.37 7.67 4.69 1.56 3.64 2.92 1.93 4.98 5.5 8.09 3.61 8.15 0 7.14 8.42 0 0 458 16659 53237 172 California 1989
1565 732 321 77 0 0 7997 465 23846 106 6669 294207 18840 1538 648938 64738 99470 217 43875 606720 298338 116 1174 501 19280 530961 73171 0 323856 3541 20780 42109 0.9 134.1 0.8 59.8 1460.5 28.1 7 1966.9 129.7 562.9 1.6 307.5 1967.7 202.4 0.4 6.7 3.7 239.9 2971.3 146.2 0 2657.7 34.4 0 592 0 0 0 62908 2 5.63 7.44 8.96 4.96 1.49 4.57 3.03 2 5.69 7.19 9.64 3.79 7.54 0 8.21 9.72 4.69 0 598 11987 63947 185 California 1990
1616 684 328 77 0 0 8348 841 25793 131 8063 295187 25499 811 646499 62994 83076 207 34320 725496 253496 185 1154 452 23311 522101 76709 0 325205 2914 19006 36430 1.7 136.4 0.8 74.8 1582.1 36.4 4 1854.8 124.1 448 1.3 197.5 2147 183.4 1 6.5 2.7 297.3 3190 146.9 0 2607.9 31.9 0.1 712 0 0 0 56335 1.97 5.29 5.88 9.27 5.36 1.43 4.9 2.87 1.97 5.43 6.13 10.01 3.86 7.83 0 8.02 10.94 5.62 0 519 14593 62030 195 California 1991
1667 1236 336 77 0 0 8805 4 13247 113 5570 292581 26710 831 788628 64801 73742 128 52806 705045 271626 1 1332 185 16103 492278 80481 0 313881 2493 15611 40771 0 66.3 0.6 51.7 1466.7 34.6 3.8 2143.5 118.6 398.4 0.6 289 1981.9 239 0 9.4 1 215.7 2861.9 140.9 0 2571.4 27.3 2.8 829 0 0 0 54717 1.83 5.01 5.28 9.27 5.01 1.3 4.57 2.72 1.83 5.44 5.03 9.96 3.58 8.64 0 8.19 10.94 6.26 0 538 23797 55988 205 California 1992
1718 0 339 119 0 0 8032 2700 13748 107 5840 259816 27751 722 694233 53625 75855 251 35695 726182 245538 593 1337 382 16883 520050 59668 0 286878 2525 12826 38854 5 72 0.6 53.6 1510 36.1 3.9 2057 99.1 426.5 1.3 178.6 1572 217.9 2.2 9.9 2.2 240.3 3123 101.9 0 2426.3 27.7 2.6 935 0 0 0 44441 1.85 5.24 5.78 9.18 5.81 1.3 5.39 2.96 1.85 5.68 5.07 9.94 2.72 7.69 0 8.46 10.97 4.58 0 748 17726 56874 213 California 1993
1769 0 349 41 0 0 7691 3282 13550 71 5745 267027 26581 667 834865 54174 81300 229 40383 688936 265761 579 1334 382 16608 530977 56637 0 324431 3859 12969 46501 6.1 65.2 0.4 58.3 1865.6 34.1 1.8 2073.8 101.2 427.1 1.1 253.6 1806.1 228.3 2.2 9.3 1.9 203 3326.3 94 0 2691 44.2 3 1180 0 0 0 40644 1.87 4.81 5.05 10.14 6.99 1.28 2.68 2.48 1.87 5.29 4.92 10.89 3.19 6.23 0 8.29 11.45 4.99 0 613 17099 51540 190 California 1994
1820 0 387 41 0 0 7763 2693 18413 152 5664 281816 23328 623 619972 57900 67887 318 30310 705432 249855 402 1019 459 16376 482729 56637 0 337210 2163 20001 28130 4.8 94.1 0.8 58 1730.8 31.8 2.9 1378.2 102.2 365.1 1.6 196.8 2156.6 215.6 1.5 7.1 2.3 193.3 3067.4 92.2 0 2833.7 25.2 4.7 1390 0 0 0 37883 1.76 5.11 5.1 10.24 6.14 1.36 4.62 2.22 1.76 5.44 4.99 10.34 3.66 6 0 8.4 11.64 5.47 0 758 11275 49015 204 California 1995
1871 0 481 119 0 0 8064 3628 14896 390 4731 243122 20000 842 538602 56202 69056 692 20011 726368 285547 495 860 586 13679 489526 58816 0 343147 1844 20060 32675 6.2 90.2 2.1 54.3 1399.8 29.7 4.3 1442.9 95.4 437.3 3.8 143.2 2162.8 213.2 2 6.6 3.1 169.5 3048.6 109.6 0 3155.1 21.2 5.3 1384 0 0 0 32728 1.7 6.06 5.32 11.48 5.76 1.48 5.08 2.68 1.7 6.4 5.55 9.97 3.65 5.96 0 9.19 11.51 4.59 0 754 5643 62874 217 California 1996
1922 0 525 54 0 0 6293 2232 14476 235 4275 258267 17965 1649 607929 62178 81686 1031 14834 807303 274606 276 925 764 12358 487098 37668 0 364674 1340 24434 33228 3.9 78.8 1.2 50 1627.6 27.8 8.2 1837.2 108.3 467.7 5.6 120.6 2734.9 208.1 1 7.5 3.8 159.9 3261.3 70 0 3325.3 15 6.9 1583 0 0 0 39677 1.74 5.45 4.95 11.69 6.3 1.54 4.94 3.02 1.74 5.79 5.4 9.55 4.11 5.64 0 9.12 11.17 4.42 0 920 2215 66377 233 California 1997
1973 0 688 119 0 0 5497 2426 15463 359 7065 298056 20082 1727 664042 43348 74767 986 11026 864795 239670 300 982 1344 20426 580925 33473 0 364004 2570 10867 34801 4.3 64.4 2.4 72.1 1786 27.8 4.7 1783.7 77.3 318.3 4 74 2525.4 199.7 1.1 6.9 8.9 240.4 3805.5 53.8 0 2895.8 25 7.2 1580 0 0 0 32653 1.78 4.16 6.63 10.2 5.99 1.38 2.75 2.69 1.78 4.31 4.06 8.35 3.55 5.16 0 7.96 9.73 4 0 868 2159 76425 242 California 1998
2024 0 538 108 0 0 5780 576 15975 163 6624 248298 22121 1621 739182 46772 85923 412 18009 803612 245371 79 996 1059 19151 576853 34354 0 376996 1473 11611 39182 1 87 1.1 69.6 1502.5 31.1 5.3 2014.5 81 452.8 1.3 135.6 2162.3 235.2 0.3 7.7 7 230.5 3763.4 56.6 0 3432.4 17.3 9.3 1235 0 0 0 35743 1.73 5.45 6.58 10.5 6.05 1.41 3.27 2.73 1.73 5.32 3.13 8.93 3.28 5.27 0 9.1 11.74 4.37 0 889 2819 77744 147 California 1999
2075 0 550 82 0 0 6186 500 18063 296 6180 235677 22070 5232 911244 47380 108733 217 21052 803825 216039 62 1403 1591 17866 494165 36997 0 410387 1309 11527 39474 0.8 143.9 2.9 82.6 1858.2 30.1 32.4 5295.7 78.8 861.1 1.5 207.4 3635.9 201.7 0.2 15.1 15.7 273.6 4242.4 91.6 0 4612.1 19 13.9 1340 0 0 0 39641 1.66 7.97 9.87 13.36 7.88 1.36 6.19 5.81 1.66 7.99 7.09 12.34 5.53 8.58 0 11.24 14.53 6.19 0 939 4237 84998 151 California 2000
2126 0 646 0 0 0 6255 1 16515 357 4242 249600 21112 7981 999529 46727 126275 239 22568 730253 266326 0 1708 1985 12263 520632 35550 0 414150 1496 13837 34111 0 115.4 3.2 61.7 2293.3 23.4 50.4 9276.8 75.4 886.1 1.7 234.1 3888.1 212.1 0 17.3 17.8 212.1 5347.4 84 0 4321.3 23.7 17.7 1400 0 0 0 44694 1.61 6.99 8.99 14.54 9.19 1.11 6.32 9.28 1.61 7.08 7.03 13.94 6.5 8.11 0 10.43 15.86 6.41 0 1152 5774 78547 162 California 2001
2177 0 660 0 0 0 6406 1 12744 155 4936 242898 22896 1303 742308 47113 85211 84 32590 799970 270687 0 854 1227 14272 520837 36085 0 421152 1921 12648 45474 0 83.1 1.4 59.6 1446.5 42.8 7.5 2775.7 77.3 574.5 0.6 376.9 3213.6 223.1 0 7.5 11.3 214.7 3633.2 77.4 0 4127.9 25.8 12.2 1400 0 0 0 27437 1.64 6.52 9.19 12.07 5.96 1.87 5.72 3.74 1.64 6.8 6.61 13.04 4.84 5.55 0 9.8 13.45 4.27 0 776 3689 90041 163 California 2002
2228 0 706 9 0 0 6670 5 10453 268 8358 237552 21715 1481 721848 47749 62549 232 23737 837461 269444 1 702 1109 20462 507874 37985 0 405115 1957 12330 48470 0 82.5 2.4 108.7 1898.2 38.5 9.1 3879.4 80.2 505.3 1.9 247.3 4971.4 197.3 0 7.4 10.1 356.1 4546.3 97.8 0 4524.2 30.1 19.7 994 0 0 0 26680 1.68 7.9 9.1 13.01 7.99 1.77 6.16 5.37 1.68 8.19 8.24 14.6 7.05 10.27 0 11.17 15.39 5.65 0 854 6802 89404 169 California 2003
2279 0 709 0 0 0 6521 168 9676 407 11800 236222 22535 1354 793193 46188 82722 242 17057 893413 271645 19 829 1567 24845 522272 38934 0 452446 1835 17144 47567 0.3 105.6 4.7 175.7 1998.7 43.7 12.5 4661.6 81.2 922.1 2.5 206 5923.1 178.3 0.1 10.6 18.2 489.6 5048.8 113.8 0 6409.7 31.9 26.7 1111 0 0 0 26939 1.76 10.91 11.61 14.89 8.46 1.94 9.25 5.88 1.76 11.27 10.41 16.69 7.74 9.65 0 14.17 17.38 6.83 0 868 4716 86811 165 California 2004
2330 0 735 54 0 0 4153 410 11451 333 9267 238473 20692 1404 709314 46284 76972 238 6224 841137 283436 36 906 1721 28251 494886 25879 0 473042 3232 20653 49125 0.9 170 4.6 165.5 2491.6 29.6 13.9 5568.5 98.2 1175.1 3.1 0.1 6896.9 233.8 0.1 15.3 23.7 643.3 5731.8 100.2 0 8505 64.4 82.8 1258 0 0 0 29671 2.12 14.85 13.76 17.86 10.45 1.43 9.91 7.85 2.12 15.45 13.09 19.9 9.62 11.54 0 17.98 19.92 8.6 0 896 6221 82338 170 California 2005
2381 0 682 73 0 0 3853 30 8594 307 6876 250003 21921 1168 795842 45062 80437 231 10633 809807 285526 3 890 1625 24664 502984 22952 0 485179 3330 17297 48899 0.1 147.3 6.8 141.1 2549.4 36.8 16.2 5172.3 107.8 1384.1 4.4 136.2 6010.6 218.9 0 17.3 36 638.6 5798 102.4 0 9693.5 72.3 78.3 1287 0 0 0 27311 2.39 17.14 22.13 20.51 10.2 1.68 13.84 6.5 2.39 17.4 19.11 22.23 9.09 12.47 0 19.98 21.71 7.75 0 870 4506 87709 174 California 2006
2432 0 630 132 0 0 4092 0 10608 175 7725 258379 23358 975 860408 43136 66300 178 6740 821358 275789 0 554 864 26156 506805 25368 0 494417 2915 20595 45229 0 194.3 4.2 172.1 2560.4 43.2 15.8 5606.4 121 1199.7 3.8 72.3 5873.6 241.7 0 11.6 21 725.5 5696.8 124.1 0 10351 69.1 85 1375 0 0 0 27817 0 18.31 24.26 22.28 9.91 1.85 16.19 6.52 2.81 18.29 21.42 25.49 8.81 14.9 0 20.94 23.7 7.5 0 706 3906 93580 187 California 2007
2483 0 532 0 0 0 4318 0 16453 79 9975 257986 23630 1012 882428 39420 73512 83 14212 809376 238700 0 839 458 32114 502833 28388 0 430665 5065 19987 46652 0 402.4 2.4 258.8 2949.8 51.7 22.8 7060.2 116.8 1781 2.3 316.7 6733.4 291.2 0 21.8 13.8 1021.6 6238.6 172.3 0 11517.9 144.4 132.5 1429 0 0 0 24662 0 24.46 30.07 25.94 11.43 2.19 22.58 8 2.96 24.53 27.15 30.48 10.51 23.38 0 26.74 28.51 11.02 0 892 3822 99815 232 California 2008
2534 0 552 3 0 0 5266 0 20296 116 7965 254462 21085 669 830777 31318 59613 61 19868 792725 217874 0 2249 973 30147 493696 37284 0 424362 3887 19706 49778 0 299.4 2.9 159.4 1920.3 47.2 9.6 3591.6 92.3 875.2 1.1 389.3 4016.6 128.9 0 41.1 24.6 782.8 4533.2 168.7 0 7503.3 84.3 97.4 1201 0 0 0 22666 0 14.75 25.27 20.01 7.55 2.24 14.38 4.32 2.95 14.77 17.68 24.14 6.39 21.03 0 17.68 21.69 7.41 0 376 3742 96398 265 California 2009
2585 0 556 65 38 0 5199 0 27293 189 8640 253329 21776 437 755324 33196 70507 69 19342 787410 224814 0 934 816 31734 505530 32551 0 429649 3306 23814 51036 0 516.5 5.1 186.8 2058.4 48.3 8 3673.1 113 1330.1 1.5 434.5 4198 150 0 21.7 22.2 966.6 4909.3 173.6 0 9247.5 81.9 75.3 1226 0 0 0 23015 0 18.92 27.17 21.62 8.13 2.22 18.44 4.86 3.41 19.09 22.1 25.78 6.87 27.81 0 21.52 24.78 5.43 0 828 2488 107803 273 California 2010
2636 0 659 45 273 0 5005 0 24205 144 8313 250867 19692 365 630122 35572 77264 65 20875 767439 233769 0 629 625 29647 522406 33291 0 438319 3805 25415 46859 0 614.6 4.7 207.3 2040.5 43.5 8.7 2904 129.5 1926.1 1.9 603.1 4212.1 161.5 0 18 20.3 1008 5089.8 213.3 0 12360.6 102.6 107.3 1226 0 0 0 25323 0 25.39 32.46 24.94 8.13 2.21 23.74 4.61 3.64 25.3 29.33 30.64 6.91 32.75 0 28.2 26.96 7.18 0 1133 1194 110120 248 California 2011
2687 0 634 26 481 0 4384 0 21757 48 8702 258277 13153 354 876854 30679 74925 33 19529 805491 218676 0 370 269 23057 487614 31071 0 421187 4116 28136 53082 0 566.2 1.6 188.1 1784.7 24.9 9.5 3147.7 108.7 1948.3 1 416.5 3606.1 145.3 0 11 9.1 780.3 4368.3 221.6 0 12131.8 107.5 102.8 1217 0 36 1 24838 0 26.02 33.86 21.62 6.91 1.89 26.89 3.59 3.54 26.26 30.12 23.04 5.66 33.22 0 28.8 26.13 6.87 0 728 1449 113199 287 California 2012
2738 0 634 50 778 10 5081 0 20160 43 8265 261889 6214 358 849409 31938 74595 12 18053 851553 243162 0 552 257 23160 495089 42908 0 438084 4961 25272 50232 0 510.9 1.5 181.1 1990.3 12.1 8.3 3740.5 117.3 1901.5 0.4 395.2 4173.6 329 0 16.3 8.6 785.6 4779.2 302.1 0 12027.4 131.2 125 1217 0 48 15 23106 0 25.34 33.54 21.91 7.6 1.96 23.23 4.4 3.67 25.71 29.44 23.17 6.39 31.56 0 27.45 26.46 8.62 0 629 998 144607 287 California 2013
2789 0 634 39 883 31 5081 0 19319 51 9179 243679 6866 380 858977 32620 80230 96 19203 866822 232106 0 544 334 17739 407530 42908 0 460508 5352 40475 53281 0 461.7 1.7 218.9 2151 17.1 7.5 4348.9 118.3 1941.6 2.6 448.6 4896.9 323.6 0 15.7 11.1 601.7 4575.1 294.6 0 12366.5 155.5 156.2 1217 0 44 16 20232 0 23.9 33.37 23.85 8.83 2.49 19.63 5.06 3.63 24.34 27.51 25.12 7.46 30.2 0 26.85 29.05 9.19 0 445 1346 152460 287 California 2014
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
<title>AS4 Trellis Plot</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
.circle {
/*fill: rgb(220,20,60);*/
/*stroke: black;*/
/*stroke-weight: 0.2px;*/
opacity: 0.7;
}
.title {
font-family: sans-serif;
font-size: 20px;
}
.axisLabels {
font-family: sans-serif;
font-size: 10px;
}
.plotnames {
font-family: sans-serif;
font-size: 14px;
}
</style>
</head>
<body>
<script type="text/javascript">
// declare dimensions
var h = 500,
w = 1000,
margin = 100,
plotH = 200,
plotW = 200;
var d = ["ConsumptionIndustrialCoal", "ConsumptionIndustrialDistillateFuelOil", "ConsumptionIndustrialNaturalGas"];
var xAxisYPos = h-margin,
yAxisXPos = margin*2,
yAxisXPos2 = margin*2 + plotW,
yAxisXPos3 = margin*3 + 2*plotW;
var titleY = margin/2,
titleX1 = plotW/2,
titleX2 = margin + plotW/2 + plotW,
titleX3 = margin*2 + plotW/2 + 2*plotW;
var yLabXTrans = h - margin - plotH/2;
// create svg variable
var svg = d3.select("body")
.append("svg")
.attr("height", h)
.attr("width", w);
// load in data
d3.csv("calData.csv", function(dataset) {
// make strings numeric
dataset.forEach(function(d) {
d.Year = +d.Year;
d.ConsumptionIndustrialCoal = +d.ConsumptionIndustrialCoal;
d.ConsumptionIndustrialDistillateFuelOil = +d.ConsumptionIndustrialDistillateFuelOil;
d.ConsumptionIndustrialNaturalGas = +d.ConsumptionIndustrialNaturalGas;
});
// define scales and axes
var xScale = d3.scaleLinear()
.domain([d3.min(dataset, function(d) { return d.Year;}), d3.max(dataset, function(d) { return d.Year})])
.range([0, plotW]),
yScale1 = d3.scaleLinear()
.domain([0, Math.ceil(d3.max(dataset, function(d) { return d.ConsumptionIndustrialCoal})/10000)*10000])
.range([plotH, 0]),
yScale2 = d3.scaleLinear()
.domain([0, Math.ceil(d3.max(dataset, function(d) { return d.ConsumptionIndustrialDistillateFuelOil})/20000)*20000])
.range([plotH, 0]),
yScale3 = d3.scaleLinear()
.domain([0, Math.ceil(d3.max(dataset, function(d) { return d.ConsumptionIndustrialNaturalGas})/100000)*100000])
.range([plotH, 0]);
var xAxis = d3.axisBottom()
.scale(xScale)
.tickValues(d3.range(d3.min(dataset, function(d) { return d.Year;}), d3.max(dataset, function(d) { return d.Year;}) + 1, 18)) // add 1 to include upper bound
.tickFormat(d3.format("d")),
yAxis1 = d3.axisLeft()
.scale(yScale1),
yAxis2 = d3.axisLeft()
.scale(yScale2),
yAxis3 = d3.axisLeft()
.scale(yScale3);
// draw axes
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + margin + " , " + xAxisYPos + ")")
.call(xAxis);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + margin + ", " + yAxisXPos + ")")
.call(yAxis1);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + yAxisXPos2 + " , " + xAxisYPos + ")")
.call(xAxis);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + yAxisXPos2 + ", " + yAxisXPos + ")")
.call(yAxis2);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + yAxisXPos3 + " , " + xAxisYPos + ")")
.call(xAxis);
svg.append("g")
.attr("class", "axis")
.attr("transform", "translate(" + yAxisXPos3 + ", " + yAxisXPos + ")")
.call(yAxis3);
// add chart title
svg.append("text")
.text("Industrial Consumption of Various Energy Types by Year")
.attr("class", "title")
.attr("x", w/2)
.attr("y", margin/2)
.attr("text-anchor", "middle");
// add plot titles
svg.append("text")
.text("Coal")
.attr("class", "plotnames")
.attr("x", plotW/2)
.attr("y", plotH/2)
.attr("transform", "translate(" + titleX1 + ", " + titleY + ")")
.attr("text-anchor", "middle");
svg.append("text")
.text("Distillate Fuel Oil")
.attr("class", "plotnames")
.attr("x", plotW/2)
.attr("y", plotH/2)
.attr("transform", "translate(" + titleX2 + ", " + titleY + ")")
.attr("text-anchor", "middle");
svg.append("text")
.text("Natural Gas")
.attr("class", "plotnames")
.attr("x", plotW/2)
.attr("y", plotH/2)
.attr("transform", "translate(" + titleX3 + ", " + titleY + ")")
.attr("text-anchor", "middle");
// add axis labels
svg.append("text")
.attr("class", "axisLabels")
.attr("x", plotW*2 + 3*margin + plotW/2)
.attr("text-anchor", "middle")
.attr("y", h - margin/2)
.text("Year");
svg.append("text")
.attr("class", "axisLabels")
.attr("x", w/2)
.attr("text-anchor", "middle")
.attr("y", h - margin/2)
.text("Year");
svg.append("text")
.attr("class", "axisLabels")
.attr("x", margin + plotW/2)
.attr("text-anchor", "middle")
.attr("y", h - margin/2)
.text("Year");
svg.append("text")
.attr("class", "axisLabels")
.attr("x", 0)
.attr("y", 0)
.attr("text-anchor", "middle")
.attr("transform", "translate(30, " + yLabXTrans + ")rotate(270)") // translate and rotate y axis label
.text("Consumption (Million BTU)");
svg.append("text")
.attr("class", "axisLabels")
.attr("x", 0)
.attr("y", 0)
.attr("text-anchor", "middle")
.attr("transform", "translate(330, " + yLabXTrans + ")rotate(270)") // translate and rotate y axis label
.text("Consumption (Million BTU)");
svg.append("text")
.attr("class", "axisLabels")
.attr("x", 0)
.attr("y", 0)
.attr("text-anchor", "middle")
.attr("transform", "translate(630, " + yLabXTrans + ")rotate(270)") // translate and rotate y axis label
.text("Consumption (Million BTU)");
// draw circles
svg.selectAll("circle1")
.data(dataset)
.enter()
.append("circle")
.attr("transform", "translate(100,200)")
.attr("class", "circle")
.attr("cx", function(d) {
return xScale(d.Year);
})
.attr("cy", function(d) {
return yScale1(d.ConsumptionIndustrialCoal);
})
.style("fill", "rgb(165,42,42)")
.attr("r", 3);
svg.selectAll("circle2")
.data(dataset)
.enter()
.append("circle")
.attr("transform", "translate(400,200)")
.attr("class", "circle")
.attr("cx", function(d) {
return xScale(d.Year);
})
.attr("cy", function(d) {
return yScale2(d.ConsumptionIndustrialDistillateFuelOil);
})
.style("fill", "rgb(204,204,0)")
.attr("r", 3);
svg.selectAll("circle3")
.data(dataset)
.enter()
.append("circle")
.attr("transform", "translate(700,200)")
.attr("class", "circle")
.attr("cx", function(d) {
return xScale(d.Year);
})
.attr("cy", function(d) {
return yScale3(d.ConsumptionIndustrialNaturalGas);
})
.style("fill", "rgb(95,158,160)")
.attr("r", 3);
});
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment