Skip to content

Instantly share code, notes, and snippets.

@doctavia
Last active May 17, 2017 03:01
Show Gist options
  • Save doctavia/31e61985fc675bcf335734f793611a17 to your computer and use it in GitHub Desktop.
Save doctavia/31e61985fc675bcf335734f793611a17 to your computer and use it in GitHub Desktop.
DataVis_2ndSub
license: mit
X YEAR CARRIER dep_delay dep_ontime arr_delay arr_ontime cancelled diverted carrier_delay weather_delay nas_delay security_delay lateAircraft_delay n total_flights delay_arr_pct ontime_arr_pct carrier_names carrier_shortnames
1 2007 9E 42638 208274 59338 190848 7939 726 1127692 200696 757374 1919 1027258 365 258851 22.92361243 73.72890196 Pinnacle Airlines Pinnacle
2 2007 AA 161404 454529 177507 436329 17924 2097 2700300 811124 3275624 7775 4074899 365 633857 28.00426595 68.83713519 American Airlines American
3 2007 AQ 3856 42116 3688 42269 388 15 77812 1056 5831 1046 53951 365 46360 7.955133736 91.1755824 Aloha Airlines Aloha
4 2007 AS 38690 118932 43158 113965 2563 499 722012 31513 407621 13452 932608 365 160185 26.94259762 71.1458626 Alaska Airlines Alaska
5 2007 B6 44479 143261 51233 135883 3710 624 562553 107400 1433643 6002 1471009 365 191450 26.76051188 70.97571167 JetBlue Airways JetBlue
6 2007 CO 70258 249942 79992 239146 2951 1062 906231 215107 2177161 16132 1482455 365 323151 24.75375289 74.0044128 Continental Airlines Continental
7 2007 DL 84271 385097 110052 358271 6521 1045 1530087 152501 1866371 6735 1620823 365 475889 23.12556079 75.28457266 Delta Airlines Delta
8 2007 EV 96070 181244 94559 182058 8920 697 2832238 760224 1123851 4990 930047 365 286234 33.03555832 63.60460323 Atlantic Southeast Airlines Atlantic Southeast
9 2007 F9 19246 78116 21865 75383 398 114 279277 39509 405929 2167 214184 365 97760 22.36599836 77.11027005 Frontier Airlines Frontier
10 2007 FL 54423 206134 60710 199159 2602 688 502204 37761 946465 0 1638724 365 263159 23.06970311 75.68010214 AirTran Airways AirTran
11 2007 HA 2444 53493 4096 51839 238 2 134564 1537 971 731 47440 365 56175 7.291499777 92.28126391 Hawaiian Airlines Hawaiian
12 2007 MQ 134610 383092 147123 369082 22792 1497 2007701 562622 2298159 1744 3639217 365 540494 27.22009865 68.28604943 American Eagle Airlines American Eagle
13 2007 NW 80149 326563 124528 281344 7814 840 2276303 316527 1910645 8769 1334434 365 414526 30.04105894 67.87125536 Northwest Airlines Northwest
14 2007 OH 58241 168879 70933 155717 8912 470 1411761 821224 1212637 4564 231407 365 236032 30.05228105 65.97283419 Comair_ Comair
15 2007 OO 116316 467378 142647 440224 14186 823 2730247 356372 1197780 19948 2609558 365 597880 23.8588011 73.63082893 Skywest Airlines Skywest
16 2007 UA 117505 360568 136529 340561 11929 983 1838180 235286 2262296 895 3719507 365 490002 27.8629475 69.50196122 United Airlines United
17 2007 US 120340 356165 149498 326085 8942 922 2042191 167759 2192671 19934 2526281 365 485447 30.79594683 67.17211148 US Airways US
18 2007 WN 261403 897475 230105 926853 9993 1920 2102273 470366 1597151 39398 6267251 365 1168871 19.68609025 79.29472115 Southwest Airlines Southwest
19 2007 XE 92372 331601 105223 317082 10800 1668 1266355 284451 2453029 11498 2547049 365 434773 24.20182486 72.93047176 Expressjet Airlines Expressjet
20 2007 YV 63848 219227 70949 211636 11287 490 1777089 172263 684266 9247 1638841 365 294362 24.10263553 71.89650838 Mesa Airlines Mesa
21 2008 9E 38518 216705 51877 202589 7100 786 908509 149270 662837 1553 905944 366 262352 19.77381533 77.22029945 Pinnacle Airlines Pinnacle
22 2008 AA 144938 442595 164384 421452 17440 1960 2821907 418677 2987319 6626 3334548 366 605236 27.16031432 69.63432446 American Airlines American
23 2008 AQ 431 7327 446 7306 42 6 8727 589 989 106 5368 60 7800 5.717948718 93.66666667 Aloha Airlines Aloha
24 2008 AS 26880 122104 32453 116101 2139 471 481833 47431 379500 7086 591343 366 151164 21.46873594 76.80466249 Alaska Airlines Alaska
25 2008 B6 41805 151098 48042 144288 3205 772 677621 55222 1309542 2101 1293235 366 196307 24.47289195 73.50119965 JetBlue Airways JetBlue
26 2008 CO 70063 224733 75372 218638 3702 898 996161 200282 1917507 11392 1254212 366 298610 25.24094973 73.21857942 Continental Airlines Continental
27 2008 DL 80094 365076 108304 335816 6813 1184 1411220 167124 1945194 1365 1600158 366 452117 23.95486124 74.27634882 Delta Airlines Delta
28 2008 EV 63013 212593 71399 203586 5026 682 1688969 565274 1127930 3559 653165 366 280693 25.43668706 72.52977452 Atlantic Southeast Airlines Atlantic Southeast
29 2008 F9 17619 77843 21403 73996 303 75 250971 21370 356334 391 187383 366 95777 22.34670119 77.25863203 Frontier Airlines Frontier
30 2008 FL 51764 207694 60872 197934 2236 735 443708 36903 1029858 0 1771466 366 261777 23.25337979 75.61168475 AirTran Airways AirTran
31 2008 HA 4560 56703 6303 54930 570 44 184855 4861 931 203 82261 366 61847 10.19127848 88.81594904 Hawaiian Airlines Hawaiian
32 2008 MQ 108087 364445 118471 352887 18331 1201 1705271 417169 1948506 1172 2604077 366 490890 24.13392002 71.8871845 American Eagle Airlines American Eagle
33 2008 NW 54775 290002 82584 261653 2906 636 1478247 309087 1301073 4516 857781 366 347779 23.74611463 75.2354225 Northwest Airlines Northwest
34 2008 OH 43840 147333 56372 134383 6462 450 1075766 672847 1091356 1282 163792 366 197667 28.51867029 67.98453966 Comair_ Comair
35 2008 OO 98464 456438 114613 439042 12434 1311 1678216 306304 1829877 12287 2355818 366 567400 20.19968276 77.37786394 Skywest Airlines Skywest
36 2008 UA 109120 329941 120020 318098 10541 995 1720150 214132 2047161 1661 3233343 366 449654 26.69163401 70.74283783 United Airlines United
37 2008 US 67784 379297 89773 356478 6582 921 1109335 101863 1567919 10900 1376627 366 453754 19.78450879 78.56195207 US Airways US
38 2008 WN 255700 933696 226880 960454 12389 2454 2261002 510665 1718542 25821 6611132 366 1202177 18.87242894 79.89289431 Southwest Airlines Southwest
39 2008 XE 78227 286353 91481 272156 9992 1104 1218009 247486 2074904 13173 1962578 366 374733 24.4123149 72.6266435 Expressjet Airlines Expressjet
40 2008 YV 54092 191732 61532 183712 9219 580 1927740 187161 874222 9122 826011 366 255043 24.12612775 72.03177503 Mesa Airlines Mesa
41 2009 9E 32933 225559 45862 212045 4926 783 708431 105985 622826 2023 644433 365 263616 17.39727482 80.43707514 Pinnacle Airlines Pinnacle
42 2009 AA 111493 431159 118459 423746 9248 1861 2283295 432667 1884383 3531 2192439 365 553314 21.40900104 76.58327821 American Airlines American
43 2009 AS 18742 117475 24378 111527 1184 443 318244 43631 291713 2834 347475 365 137532 17.72532938 81.09167321 Alaska Airlines Alaska
44 2009 B6 37358 154408 40804 150846 2617 517 711440 45380 944248 2375 834157 365 194784 20.94833251 77.44270577 JetBlue Airways JetBlue
45 2009 CO 52030 204830 57469 199303 1357 746 703842 146359 1366678 10830 702806 365 258875 22.19951714 76.98812168 Continental Airlines Continental
46 2009 DL 73126 350280 93530 329615 4790 1027 1190233 154579 1786806 1310 1275380 365 428962 21.80379614 76.84013969 Delta Airlines Delta
47 2009 EV 69358 223770 84620 208058 6175 818 1129897 195657 1349463 1574 1962953 365 299671 28.23763394 69.42880692 Atlantic Southeast Airlines Atlantic Southeast
48 2009 F9 16696 69743 18941 67492 552 93 180181 19105 262146 0 391522 365 87078 21.75176279 77.50752199 Frontier Airlines Frontier
49 2009 FL 54410 195135 60987 188463 1925 619 503089 26732 948352 0 1661498 365 251994 24.20176671 74.78868544 AirTran Airways AirTran
50 2009 HA 3712 69074 6248 66516 150 58 186518 1560 1393 474 44217 365 72972 8.562188237 91.15277093 Hawaiian Airlines Hawaiian
51 2009 MQ 83992 342509 92736 333040 11119 1081 1333799 371160 1283549 2894 1851244 365 437976 21.17376295 76.04069629 American Eagle Airlines American Eagle
52 2009 NW 46902 244478 63652 227552 1897 582 1080477 223500 912682 3756 680527 365 293683 21.67370941 77.48218317 Northwest Airlines Northwest
53 2009 OH 32736 114098 44480 102037 5156 396 772380 440540 924186 1516 219772 365 152069 29.24987999 67.09914578 Comair_ Comair
54 2009 OO 83941 456465 98234 441125 7780 1345 992380 113241 1379022 5769 2346063 365 548484 17.910094 80.42622939 Skywest Airlines Skywest
55 2009 UA 64761 306153 68856 301730 6378 764 983008 104269 1062730 1934 1732456 365 377728 18.22899017 79.88023128 United Airlines United
56 2009 US 53886 355260 80552 328114 5133 728 906489 83511 1444734 7244 1051684 365 414527 19.43226859 79.15383075 US Airways US
57 2009 WN 234902 888844 193642 929614 8594 1936 2123036 385787 1287158 19613 4742487 365 1133786 17.07923718 81.99201613 Southwest Airlines Southwest
58 2009 XE 49311 256075 64179 240978 5489 1072 695052 187183 1700616 6091 1118848 365 311718 20.58880142 77.30641156 Expressjet Airlines Expressjet
59 2009 YV 44108 195465 48374 190753 4907 594 1704272 209531 767601 5058 110306 365 244628 19.77451477 77.97676472 Mesa Airlines Mesa
60 2010 9E 41897 212319 52725 200788 7653 745 918581 121454 631091 3105 940517 365 261911 20.13088416 76.66268313 Pinnacle Airlines Pinnacle
61 2010 AA 98527 433570 103091 428599 9146 1957 1993052 358453 1502617 5964 1705902 365 542793 18.9926915 78.96177733 American Airlines American
62 2010 AS 14002 122221 18355 117584 797 384 239594 29271 213336 2438 256691 365 137120 13.38608518 85.75262544 Alaska Airlines Alaska
63 2010 B6 43607 153759 45497 151750 4116 504 939197 57594 752270 3857 964734 365 201867 22.53810677 75.17325764 JetBlue Airways JetBlue
64 2010 CO 42229 195098 47368 189887 1986 620 619333 99141 845883 18615 493598 365 239861 19.74810411 79.16543331 Continental Airlines Continental
65 2010 DL 143953 574767 158803 559096 14857 1621 2910046 380885 2317622 3371 2583280 365 734377 21.62417941 76.13201394 Delta Airlines Delta
66 2010 EV 61468 251237 61494 250806 7517 617 1325946 184852 722237 2427 1645454 365 320434 19.19084741 78.27072034 Atlantic Southeast Airlines Atlantic Southeast
67 2010 F9 14405 67222 15488 66115 352 167 156994 12116 197692 0 356149 365 82122 18.85974526 80.50826819 Frontier Airlines Frontier
68 2010 FL 37893 208346 41804 204326 2674 631 396780 33321 684678 0 1135552 365 249435 16.75947642 81.9155291 AirTran Airways AirTran
69 2010 HA 3851 63748 5867 61725 55 64 157988 1486 1833 441 54626 365 67711 8.664766434 91.15948664 Hawaiian Airlines Hawaiian
70 2010 MQ 83283 342206 91830 332926 12075 1073 1389821 353543 1270102 5026 1758747 365 437904 20.97034967 76.02716577 American Eagle Airlines American Eagle
71 2010 OH 28097 114103 36356 105566 5645 301 908078 232052 613873 1015 148616 365 147868 24.58679363 71.39205237 Comair_ Comair
72 2010 OO 106521 481932 121539 465503 11932 1748 1389117 150120 1544218 7254 3120898 365 600722 20.23215397 77.49058633 Skywest Airlines Skywest
73 2010 UA 49546 288719 48406 289570 5010 748 657918 77169 792328 1321 1131436 365 343734 14.08240093 84.24246656 United Airlines United
74 2010 US 48958 352223 68608 332110 6290 683 863480 93346 1097368 10371 896539 365 407691 16.82843134 81.46120469 US Airways US
75 2010 WN 280164 832790 227638 884669 11597 2166 2810519 387527 1292940 26844 5511392 365 1126070 20.21526193 78.56252276 Southwest Airlines Southwest
76 2010 XE 67602 309542 82685 294198 8114 1072 1046190 150767 1442939 12001 1668698 365 386069 21.417156 76.20347658 Expressjet Airlines Expressjet
77 2010 YV 24436 147099 27447 143838 3439 373 494871 62115 306091 3360 545424 365 175097 15.6753114 82.14760961 Mesa Airlines Mesa
78 2011 AA 102997 421949 106476 418050 13527 2024 2133621 401882 1508508 2337 1874194 365 540077 19.71496657 77.4056292 American Airlines American
79 2011 AS 13695 129128 17997 124577 966 372 262287 26333 220792 2900 254394 365 143912 12.50555895 86.56470621 Alaska Airlines Alaska
80 2011 B6 49023 163125 53539 158461 3895 633 1069602 73981 993294 3794 1200884 365 216528 24.72613242 73.18268307 JetBlue Airways JetBlue
81 2011 CO 48458 194047 57677 184712 2885 662 795418 118386 1084607 7280 625501 365 245936 23.4520363 75.10571856 Continental Airlines Continental
82 2011 DL 114151 608395 128511 593458 10188 1433 2188241 300469 1827410 2316 2061147 365 733590 17.51809594 80.89777669 Delta Airlines Delta
83 2011 EV 71352 247496 75774 242520 9415 726 1788303 172145 634309 3478 2154904 365 328435 23.07123175 73.84109489 Atlantic Southeast Airlines Atlantic Southeast
84 2011 F9 17374 67527 18348 66528 596 139 198889 18155 309822 0 323445 365 85611 21.43182535 77.70964012 Frontier Airlines Frontier
85 2011 FL 31588 214419 38061 207811 2790 608 345789 32337 639600 0 972376 365 249270 15.26898544 83.36783408 AirTran Airways AirTran
86 2011 HA 4219 62403 5542 61075 122 44 138703 2687 874 222 67740 365 66783 8.298519084 91.45291466 Hawaiian Airlines Hawaiian
87 2011 MQ 79489 351771 90632 339730 17658 1163 1495670 410623 1430509 520 1624753 365 449183 20.17707705 75.63287124 American Eagle Airlines American Eagle
88 2011 OO 101895 473517 117141 457070 12688 1442 1348192 139645 1400901 6274 2948969 365 588341 19.9103921 77.68793948 Skywest Airlines Skywest
89 2011 UA 54635 251938 58816 247447 4880 594 836099 95246 993489 1890 1397413 365 311737 18.86718612 79.37684651 United Airlines United
90 2011 US 59768 343069 81118 321030 6605 781 1151148 126345 1329213 12143 1054506 365 409534 19.80739084 78.3890959 US Airways US
91 2011 WN 264444 879216 212222 930735 12147 2272 2665593 401925 1323522 29827 5661162 365 1157376 18.33647838 80.41768621 Southwest Airlines Southwest
92 2011 XE 82201 317279 94864 304157 14117 1265 1747864 151793 1412607 6345 2324357 365 414403 22.89172617 73.39642811 Expressjet Airlines Expressjet
93 2011 YV 21174 131787 23395 129350 3499 241 387822 86421 193753 2027 634020 365 156485 14.95031473 82.65967984 Mesa Airlines Mesa
94 2012 AA 102962 412935 112581 402941 9569 1777 2140405 343832 1419535 4362 2295722 366 526868 21.36797073 76.47854871 American Airlines American
95 2012 AS 15360 131087 18795 127345 1197 441 280863 40336 230849 3351 317018 366 147778 12.71840193 86.17317869 Alaska Airlines Alaska
96 2012 B6 44218 182508 46588 180000 2387 450 938191 79334 670333 4590 1080200 366 229425 20.30641822 78.4570121 JetBlue Airways JetBlue
97 2012 DL 94508 628857 103278 619802 3713 1260 1965386 178807 1361153 2025 1629431 366 728053 14.18550573 85.13143961 Delta Airlines Delta
98 2012 EV 163242 562880 160243 565072 15272 1833 3441656 375026 1872886 5186 4540000 366 742420 21.58387436 76.1121737 Atlantic Southeast Airlines Atlantic Southeast
99 2012 F9 16742 62277 18237 60763 250 116 217305 13588 276770 0 287282 366 79366 22.97835345 76.5604919 Frontier Airlines Frontier
100 2012 FL 23171 193519 29413 187203 1511 414 291128 10554 449045 0 609054 366 218541 13.45880178 85.66035664 AirTran Airways AirTran
101 2012 HA 4354 69691 6099 67938 67 40 158544 3581 3703 448 61695 366 74144 8.225884765 91.62980147 Hawaiian Airlines Hawaiian
102 2012 MQ 72807 390471 79371 383229 10373 1192 1449895 461716 1017505 2199 1553034 366 474165 16.7391098 80.82186581 American Eagle Airlines American Eagle
103 2012 OO 101875 505330 111883 494316 11167 1235 1360820 109605 1277785 4660 2829060 366 618601 18.08645637 79.90869721 Skywest Airlines Skywest
104 2012 UA 127188 396792 117973 405519 7599 1130 2117628 158014 1661009 9977 2483603 366 532221 22.16616781 76.19372404 United Airlines United
105 2012 US 44238 356359 58341 341876 3990 506 803116 71106 892918 9406 613958 366 404713 14.41540054 84.47368876 US Airways US
106 2012 VX 8781 45680 8731 45718 285 74 87122 43565 304401 967 182814 366 54808 15.93015618 83.41482995 Virgin America Virgin America
107 2012 WN 232554 898474 189985 940569 9580 1880 2598575 355588 1231329 23587 4612577 366 1142014 16.63596068 82.360549 Southwest Airlines Southwest
108 2012 YV 17381 114797 19415 112642 1902 171 314822 35158 159601 2294 474104 366 134130 14.47476329 83.97972117 Mesa Airlines Mesa
109 2013 9E 44633 245401 50736 238163 7195 607 1059381 130727 877054 3218 1048829 365 296701 17.10004348 80.2703732 Pinnacle Airlines Pinnacle
110 2013 AA 108776 419619 108865 417491 9749 1786 1927664 341701 1406221 6384 2673758 365 537891 20.23923062 77.61628285 American Airlines American
111 2013 AS 13723 140372 18796 134881 704 362 256638 32302 270987 5875 282671 365 154743 12.14659145 87.1645244 Alaska Airlines Alaska
112 2013 B6 54018 185822 59176 179969 2013 619 1074604 70959 998064 10231 1448875 365 241777 24.47544638 74.43594717 JetBlue Airways JetBlue
113 2013 DL 105030 647380 113157 637735 2435 1343 2691572 333994 1749949 7816 1851196 365 754670 14.99423589 84.50514795 Delta Airlines Delta
114 2013 EV 174362 553842 180484 544704 21307 2201 3366064 312367 2859779 5278 5311897 365 748696 24.10644641 72.75369442 Atlantic Southeast Airlines Atlantic Southeast
115 2013 F9 17721 57628 19950 55260 283 119 229551 19914 446957 0 421771 365 75612 26.38470084 73.08363752 Frontier Airlines Frontier
116 2013 FL 32418 140282 34131 138202 1326 293 389441 44578 489751 0 867680 365 173952 19.62092991 79.44835357 AirTran Airways AirTran
117 2013 HA 3268 68956 4712 67457 68 49 159197 3699 3906 778 56951 365 72286 6.51855131 93.31959162 Hawaiian Airlines Hawaiian
118 2013 MQ 96340 328458 105983 317155 15701 1026 1716605 643256 1577059 2348 2636992 365 439865 24.09443807 72.10280427 American Eagle Airlines American Eagle
119 2013 OO 101361 511861 111864 498958 13926 1611 1694065 182183 1450952 8047 3182279 365 626359 17.85940651 79.66006715 Skywest Airlines Skywest
120 2013 UA 102699 398433 98754 400941 4920 1183 1732247 201021 1713003 6076 2174917 365 505798 19.52439511 79.26899671 United Airlines United
121 2013 US 52219 356504 71791 335954 4030 598 1091974 99878 1272552 11621 954772 365 412373 17.40923872 81.46847636 US Airways US
122 2013 VX 9410 47465 9892 46890 261 90 104426 41564 311105 5712 224852 365 57133 17.31398666 82.07165736 Virgin America Virgin America
123 2013 WN 291426 830943 252944 867219 8440 2101 3177218 447198 1749046 24200 6254875 365 1130704 22.37048777 76.69726118 Southwest Airlines Southwest
124 2013 YV 23952 113479 28042 109054 3654 172 466250 68812 250481 6067 903720 365 140922 19.89895119 77.38607173 Mesa Airlines Mesa
125 2014 AA 109406 420080 119751 407532 8457 1957 2196265 408197 1632082 4225 2890508 365 537697 22.2710932 75.79212828 American Airlines American
126 2014 AS 16607 142961 20975 138080 759 443 289072 33869 304865 3943 357742 365 160257 13.08835183 86.16160293 Alaska Airlines Alaska
127 2014 B6 49843 193892 54594 188333 6076 690 951159 141661 937446 8216 1195747 365 249693 21.86444954 75.42582291 JetBlue Airways JetBlue
128 2014 DL 115991 678042 122489 670011 6502 1373 2694134 498602 1833423 3556 1935914 365 800375 15.30395127 83.71213494 Delta Airlines Delta
129 2014 EV 155334 497390 164412 485353 34128 2128 3335616 276162 2680248 2833 4527875 365 686021 23.96603019 70.7490004 Atlantic Southeast Airlines Atlantic Southeast
130 2014 F9 18320 66815 21654 63314 357 149 254513 20749 533348 0 518413 365 85474 25.3340197 74.07398741 Frontier Airlines Frontier
131 2014 FL 14299 63715 13518 64300 1516 161 166873 20783 168921 0 322035 362 79495 17.00484307 80.88559029 AirTran Airways AirTran
132 2014 HA 3782 70803 5826 68670 158 78 161083 5351 8862 289 71264 365 74732 7.795857196 91.8883477 Hawaiian Airlines Hawaiian
133 2014 MQ 83574 288827 100392 270132 21156 1021 1429366 462284 1628576 5425 2127224 365 392701 25.56448799 68.78821292 American Eagle Airlines American Eagle
134 2014 OO 111354 484289 125024 468050 18308 1648 1991706 184342 1582523 7489 3470355 365 613030 20.3944342 76.35026018 Skywest Airlines Skywest
135 2014 UA 115972 370555 109965 375027 7330 1206 1985119 282459 1793066 208 2412901 365 493528 22.28141058 75.98900164 United Airlines United
136 2014 US 56928 351445 72596 334587 6737 745 1264474 130887 1159883 13627 959085 365 414665 17.50714432 80.68850759 US Airways US
137 2014 VX 9484 47700 10199 46857 335 119 100494 44487 310494 1689 210311 365 57510 17.73430708 81.476265 Virgin America Virgin America
138 2014 WN 334478 825183 299133 857604 15165 2731 4439535 478836 1945812 13850 8484610 365 1174633 25.46608175 73.01037856 Southwest Airlines Southwest
139 2015 AA 123739 591859 130279 582656 10919 2130 2753994 467420 1760561 16158 2833302 365 725984 17.94516133 80.25741614 American Airlines American
140 2015 AS 18703 153207 22352 149087 669 413 347425 38832 301478 5825 381417 365 172521 12.95610389 86.41672608 Alaska Airlines Alaska
141 2015 B6 57691 205152 59175 202867 4276 730 1074056 115770 991461 11417 1417496 365 267048 22.15893772 75.96649292 JetBlue Airways JetBlue
142 2015 DL 123364 748813 118023 752252 3824 1782 2707569 602901 1779383 3910 2136128 365 875881 13.47477568 85.88518303 Delta Airlines Delta
143 2015 EV 96997 460297 109184 445568 15231 1994 2363973 169313 1687894 0 2628976 365 571977 19.08887945 77.89963582 Atlantic Southeast Airlines Atlantic Southeast
144 2015 F9 20781 69509 23570 66520 588 158 346950 21616 581234 0 634039 365 90836 25.94786208 73.23087763 Frontier Airlines Frontier
145 2015 HA 5585 70534 8618 67423 171 60 196422 11429 6241 401 126699 365 76272 11.29903503 88.39810153 Hawaiian Airlines Hawaiian
146 2015 MQ 56293 223989 60547 218244 15025 816 1055033 402305 930774 7049 1417073 365 294632 20.55004209 74.0734204 American Eagle Airlines American Eagle
147 2015 NK 31602 83852 34221 80972 2004 182 471115 44088 941423 5147 701218 365 117379 29.15427802 68.98337863 Spirit Airlines Spirit
148 2015 OO 96592 482494 107795 469019 9960 1579 2043703 250325 1333972 9896 2868684 365 588353 18.32148387 79.71727857 Skywest Airlines Skywest
149 2015 UA 120591 388943 104722 403040 6573 1388 2214313 325044 1510372 1305 2724772 365 515723 20.30586187 78.15048001 United Airlines United
150 2015 US 29144 165681 36549 157674 4067 425 636322 70557 601963 6163 523060 181 198715 18.39267292 79.34680321 US Airways US
151 2015 VX 11029 50356 11778 49470 534 121 130710 35264 239808 1826 255509 365 61903 19.02654152 79.91535144 Virgin America Virgin America
152 2015 WN 265443 980686 236626 1005777 16043 3409 3831371 545369 1669198 11888 6313558 365 1261855 18.75223381 79.70622615 Southwest Airlines Southwest
153 2016 AA 154040 750200 175453 725959 10867 2216 3630189 550751 2645952 21871 3860602 366 914495 19.18578013 79.38359422 American Airlines American
154 2016 AS 16915 159605 21196 154817 815 452 292807 33228 345528 4943 320118 366 177280 11.95622744 87.32908394 Alaska Airlines Alaska
155 2016 B6 66646 212102 66137 211874 3797 665 1303388 140844 1017852 12440 1780017 366 282473 23.41356519 75.00681481 JetBlue Airways JetBlue
156 2016 DL 127928 790802 118938 797958 4116 1734 3363437 492018 1862011 5816 2434638 366 922746 12.88957091 86.47645181 Delta Airlines Delta
157 2016 EV 81252 398290 85667 391857 11889 1577 2523487 124933 1372877 0 2288326 366 490990 17.44780953 79.80956842 Atlantic Southeast Airlines Atlantic Southeast
158 2016 F9 20389 73591 21484 72308 1179 150 373745 26202 420193 0 701032 366 95121 22.58596945 76.01686273 Frontier Airlines Frontier
159 2016 HA 4698 71988 6648 69939 118 84 169417 10633 7638 800 85443 366 76789 8.657490005 91.07945148 Hawaiian Airlines Hawaiian
160 2016 NK 31333 104341 32659 102712 2629 199 328957 29998 1234310 3679 476425 366 138199 23.6318642 74.3218113 Spirit Airlines Spirit
161 2016 OO 87740 510209 97028 498550 8446 1909 2259043 327641 1385439 7025 2768730 366 605933 16.01299154 82.27807365 Skywest Airlines Skywest
162 2016 UA 101841 438008 92841 445349 5470 1407 1854812 311233 1656816 2078 2532015 366 545067 17.03295191 81.70536833 United Airlines United
163 2016 VX 14484 53993 15577 52680 669 195 172168 44201 324994 3655 343867 366 69121 22.53584294 76.21417514 Virgin America Virgin America
164 2016 WN 246277 1037530 230611 1049903 15866 3064 3261887 514401 1897007 19618 5867185 366 1299444 17.7468979 80.7963252 Southwest Airlines Southwest
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://d3plus.org/js/d3plus.js"></script>
<script src="https://code.jquery.com/jquery.js"></script>
<title> US Carriers and Airports Performance </title>
<style type ="text/css">
h1 {
text-align: center;
font: 25px sans-serif;
font-weight: bold;
}
circle {
stroke: black;
stroke-width: 0.7;
opacity: 0.9;
}
path {
stroke: steelblue;
fill: none;
}
text{
font: 10px sans-serif;
}
.tooltip {
position: absolute;
text-align: center;
width: 150px;
height: 50px;
padding: 2px;
font: 10px sans-serif;
font-weight: bold;
background: lightsteelblue;
border: 0px;
border-radius: 8px;
pointer-events: none;
}
.axis path, .axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
stroke-width: 2px;
}
.label {
fill: #777;
}
.year.label {
font: 500 100px "Helvetica Neue";
fill: #ddd;
}
.year.label.active {
fill: #aaa;
}
.overlay {
fill: none;
pointer-events: all;
cursor: ew-resize;
}
.select_year{
position: absolute;
top: 180px;
left: 1100px;
}
div.years_buttons {
position: absolute;
top: 200px;
left : 1100px;
}
div.years_buttons div {
background-color: rgb(251, 201, 127);
border-radius: 2px;
padding: 3px;
margin: 7px;
}
div.airlines_buttons {
position: relative;
text-align: center;
top:400;
left:50;
width: 750px;
}
div.airlines_buttons div{
float: left;
display: inline;
border: 2px solid black;
border: 1.5px solid black;
text-align: center;
font-size: 14px;
padding: 5px 5px;
border-radius: 2px;
margin: 5px;
transition-duration: 0.4s;
}
.legend_text {
font: 12px sans-serif;
font-weight: bold;
}
</style>
<script type="text/javascript">
function drawBubbles(data) {
function x(d) { return d.delay_arr_pct; }
function y(d) { return d.ontime_arr_pct; }
function radius(d) { return d.total_flights; }
function color(d) { return d.CARRIER; }
function key(d) { return d.CARRIER; }
// Set dimension of canvas
var margin = {top: 40, right: 100, bottom: 30, left: 40},
width = 800 - margin.right - margin.left,
height = 500 - margin.top - margin.bottom;
// Scales
var xScale = d3.scale.linear().domain([0,35]).range([0,width]),
yScale = d3.scale.linear().domain([50,100]).range([height,0]),
radiusScale = d3.scale.sqrt().domain([0, 500000]).range([0,20]),
colorScale = d3.scale.category20();
// x and y-axes
var xAxis = d3.svg.axis().orient("bottom").scale(xScale),
yAxis = d3.svg.axis().scale(yScale).orient("left");
// Add svg on webpage
var svg1 = d3.select("div#chart").append("svg")
.style("width", window.innerWidth)
.style("height", window.innerHeight)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
// Add x-axis
svg1.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
// Add y-axis
svg1.append("g")
.attr("class", "y axis")
.call(yAxis);
// Add an x-axis label
svg1.append("text")
.attr("class", "x label")
.attr("text-anchor", "middle")
.attr("x", width/2)
.attr("y", height+margin.bottom/1.0)
.text("Delayed Arrival (%)")
// Add y-axis label
svg1.append("text")
.attr("class", "y label")
.attr("transform", "rotate(-90)")
.attr("y", 0- margin.left)
.attr("x", 0-(height/2))
.attr("dy", "1em")
.attr("text-anchor", "middle")
.text("Ontime Arrival (%)")
// Add overlay year label
var label = svg1.append("text")
.attr("class", "year label")
.attr("text-anchor", "end")
.attr("x", width)
.attr("y", height -24)
.text("2007");
// Add tooltip area to webpage
var tooltip1 = d3.select("body")
.append("div")
.attr("class", "tooltip")
.style("opacity", 0);
// Group data by YEAR
var NestedData = d3.nest()
.key(function(d) { return d['YEAR']; })
.entries(data);
//debugger;
// Smaller circle drawn on top
function order(a,b) {
return radius(b) - radius(a);
};
// Format value to 2 decimal place
var formatDec = d3.format(".2f")
// Carriers List and Assigned Color
// https://nickqizhu.github.io/d3-cookbook/src/chapter4/ordinal-scale.html
// http://www.rapidtables.com/web/color/RGB_Color.htm
var carrier_colors2 = d3.entries(
{"All" : {fill:"none", opacity:0.9},
"AirTran": {fill:"#3182bd", circle_id: "AirTranAirways", circletext_id: "FL", opacity:0.9},
"Alaska": {fill:" #6baed6", circle_id: "AlaskaAirlines", circletext_id: "AS", opacity:0.9},
"Aloha": {fill:"#9ecae1", circle_id: "AlohaAirlines", circletext_id: "AQ", opacity:0.9},
"American": {fill:"#c6dbef", circle_id: "AmericanAirlines", circletext_id: "AA", opacity:0.9},
"American Eagle": {fill:"#ff7f0e", circle_id: "AmericanEagleAirlines", circletext_id: "MQ", opacity:0.9},
"Atlantic Southeast" :{fill:"#ffbb78", circle_id: "AtlanticSoutheastAirlines", circletext_id: "EV", opacity:0.9},
"Comair" :{ fill:"#2ca02c ", circle_id: "Comair_", circletext_id: "OH", opacity:0.9},
"Continental" :{fill:"#98df8a", circle_id: "ContinentalAirlines", circletext_id: "CO", opacity:0.9},
"Delta": {fill:"#d62728", circle_id: "DeltaAirlines", circletext_id: "DL", opacity:0.9},
"Expressjet" :{fill:"#ff9896", circle_id: "ExpressjetAirlines", circletext_id: "XE", opacity:0.9},
"Frontier": {fill:"#9467bd", circle_id: "FrontierAirlines", circletext_id: "F9", opacity:0.9},
"Hawaiian": {fill:"#c5b0d5", circle_id: "HawaiianAirlines", circletext_id: "HA", opacity:0.9},
"JetBlue": {fill:"#8c564b", circle_id: "JetBlueAirways", circletext_id: "B6", opacity:0.9},
"Mesa" :{fill:"#BD948C", circle_id: "MesaAirlines", circletext_id: "YV", opacity:0.9},
"Northwest": {fill:"#e377c2", circle_id: "NorthwestAirlines", circletext_id: "NW", opacity:0.9},
"Pinnacle": {fill:"#e8cee0", circle_id: "PinnacleAirlines", circletext_id: "9E", opacity:0.9},
"Skywest": {fill:"#7f7f7f", circle_id: "SkywestAirlines", circletext_id: "OO", opacity:0.9},
"Southwest": {fill:"#C0C0C0", circle_id: "SouthwestAirlines", circletext_id: "WN", opacity:0.9},
"Spirit": {fill:"#bcbd22", circle_id: "SpiritAirlines", circletext_id: "NK", opacity:0.9},
"United": {fill:"#efef29", circle_id: "UnitedAirlines", circletext_id: "UA", opacity:0.9},
"US": {fill:"#17becf", circle_id: "USAirways", circletext_id: "US", opacity:0.9},
"Virgin America": {fill:"#6debf9", circle_id: "VirginAmerica", circletext_id: "VX", opacity:0.9}
}
)
// Chart showed before animation starts
svg1.append('g')
.selectAll("circle")
.data(NestedData[0].values)
.enter()
.append("circle")
.attr("cx", function(d) { return xScale(d.delay_arr_pct); })
.attr("cy", function(d) { return yScale(d.ontime_arr_pct); })
.attr("r", function(d) { return radiusScale(d.total_flights); })
.attr("fill", function(d) { return carrier_colors2[(carrier_colors2.map(function(v) { return v.key})).indexOf(d.carrier_shortnames)].value.fill })
.attr('opacity', 0.9)
.attr('stroke', 'black')
.attr('stroke-width', 0.7)
.sort(order)
//// Add legend and its text
// Specify legend position
var circle_base = 100,
legend_x = 550;
// Add legend text
svg1.append('text')
.attr("class", "legend_text")
.attr("x", legend_x - 30)
.attr("y", circle_base - (3*12.5) -30)
.text("Total Flights")
// Draw stacked circles
svg1.append('g')
.attr("class", "legend")
.selectAll('g')
.data([100000, 600000, 1500000])
.enter()
.append('circle')
.attr("cx", legend_x)
.attr("cy", function(d,i) { return circle_base - i*12.5 })
.attr("r", function(d) { return radiusScale(d); })
.attr("fill", "none")
.attr("stroke", 'black')
.attr("stroke-width", 0.9)
.sort(order)
// Add value to circles
svg1.append('g')
.attr("class", "legend_digits")
.selectAll("legend_digits")
.data(["100K", "600K", "1500K"])
.enter()
.append("text")
.attr("x", legend_x +50)
.attr("y", function(d,i) { return circle_base - (2*i*12.5)})
.text(function(d) { return d })
.attr("font-family", "Arial Black")
.attr("fill", "black")
.attr("font-size", "8px");
// Add lines to guide circle to value
svg1.append('g')
.attr("class", "legend_line")
.selectAll("legend_line")
.data([100000, 600000, 1500000])
.enter()
.append("line")
.style("stroke-width", 0.5)
.style("stroke", "black")
.attr("x1", legend_x)
.attr("y1", function(d,i) { return circle_base - (2*i*12.5) -10})
.attr("x2", legend_x + 60)
.attr("y2", function(d,i) { return circle_base - (2*i*12.5) - 10})
function update1(year) {
// Filter grouped data by year (for animation)
var filtered = NestedData.filter(function(d) {
return new Date(d['key']).getFullYear() === year;
});
// Overlay year label
label.text(Math.round(year));
// Remove circles from previous plot
svg1.selectAll('circle').remove();
svg1.select('#circletext').remove();
// Add legend
var legend = svg1.append('g')
.attr("class", "legend")
.selectAll('g')
.data([100000, 600000, 1500000])
.enter()
.append('circle')
.attr("cx", legend_x)
.attr("cy", function(d,i) { return circle_base - i*12.5 })
.attr("r", function(d) { return radiusScale(d); })
.attr("fill", "none")
.attr("stroke", 'black')
.attr("stroke-width", 0.9)
.sort(order)
// Append circles
var circles = svg1.selectAll('circle1')
.data(filtered[0].values)
circles.enter()
.append('circle')
.attr("class", "bubbles")
circles
.attr("cx", function(d) { return xScale(d.delay_arr_pct)} )
.attr("cy", function(d) { return yScale(d.ontime_arr_pct)} )
.attr("r", function(d) { return radiusScale(d.total_flights)} )
.attr('fill', function(d) { return carrier_colors2[(carrier_colors2.map(function(v) {
return v.key})).indexOf(d.carrier_shortnames)].value.fill })
.attr("id", function(d) { return (d.carrier_names).replace(/\s/g, '') })
.sort(order)
.on("mouseover", function(d) {
tooltip1.transition()
.duration(500)
.style("opacity", .9);
tooltip1.html(d["carrier_names"] + "</br> (" + formatDec(d["delay_arr_pct"]) + "%" + ", " + formatDec(d["ontime_arr_pct"]) + "%" + ")"+ "</br>" + "Annual Flights: " + d["total_flights"] )
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY -60 ) + "px")
})
.on("mouseout", function(d) {
tooltip1.transition()
.duration(500)
.style("opacity", 0)
});
// Add carrier unique code onto each carrier circle
var addText = svg1.append('g')
.attr("id","circletext")
.selectAll('circletext')
.data(filtered[0].values)
.enter()
.append("text")
circleText = addText
.attr("x", function(d) { return xScale(d.delay_arr_pct) })
.attr("y", function(d) { return yScale(d.ontime_arr_pct) })
.attr("id", function(d) { return d.CARRIER})
.text(function(d) {return d.CARRIER})
.style("text-anchor", "middle")
.attr("font-family", "Arial Black")
.attr("fill", "grey")
.attr("font-size", "8px")
}; // end of function update(year)
// Get years variable 2007-2016
var years = [];
for (var year = 2007; year <= 2016; year += 1) {
years.push(year);
};
var carrier_list = ["All", "AirTran", "Alaska", "Aloha", "American",
"American Eagle", "Atlantic Southeast", "Comair", "Continental", "Delta",
"Expressjet", "Frontier", "Hawaiian", "JetBlue", "Mesa", "Northwest",
"Pinnacle", "Skywest", "Southwest", "Spirit", "United", "US",
"Virgin America"]; // 23 airlines, 0-22
// Initial year index
var year_idx = 0;
// Set chart to update for each year
var year_interval = setInterval(function() {
update1(years[year_idx]);
year_idx++;
if (year_idx >= years.length) {
clearInterval(year_interval);
// Add select year text and a set of year buttons after animation ends
var select_year = d3.select('#chart')
.append("text")
.attr("class", "select_year")
//.attr("x" , width)
//.attr("y" , circle_base - (3*12.5) + 30 )
.style("font-family", "sans-serif")
.style("font-size", "14px")
.style("font-weight", "bold")
.style("color", "Black")
.text(" Year");
var buttons = d3.select("#chart")
.append("div")
.attr("class", "years_buttons")
.selectAll("div")
.data(years)
.enter()
.append("div")
.attr("value", function(d) { return d; })
.attr("id", function(d) { return d; })
.text(function(d) { return d; });
// Add buttons for all airlines
var carrier_buttons = d3.select("#vis")
.append("div")
.attr("class", "airlines_buttons")
.selectAll("div")
.data(carrier_list)
.enter()
.append("div")
.attr("value", function(d) { return d} )
.attr("id", function(d) { return d})
.text(function(d) { return d})
.style("background-color", function(d) { return carrier_colors2[(carrier_colors2.map(function(v) {
return v.key})).indexOf(d)].value.fill })
.style("opacity", 0.9)
var Click_buttons = d3.select("#click_buttons_text")
.append("text")
.attr("class", "Click_buttons")
.style("font-family", "sans-serif")
.style("font-size", "14px")
.style("font-weight", "bold")
.style("color", "Black")
.text(" Click buttons to toggle carrier visibility");
// Event listener for year buttons
for (var year=2007; year<=2016; year++) {
(function(year) {
document.getElementById(String(year)).addEventListener("click", function() {
d3.select(".years_buttons")
.selectAll("div")
.transition()
.duration(500)
.style('color', 'black')
.style('background', 'rgb(251, 201, 127)')
d3.select(this)
.transition()
.duration(500)
.style("background", "lightBlue")
.style("color", "white");
update1(year);
})
})(year);
} // end of for loop
// Toggle to hide or show bubbles
// https://stackoverflow.com/questions/40981761/how-to-toggle-this-element
for (var i = 0; i<=22; i++) {
(function(i) {
var toggle = true;
document.getElementById(carrier_list[i]).addEventListener("click", function() {
// Hide all bubbles and circle texts when All is clicked
if (carrier_list[i] == "All") {
for (var j = 1; j <=22; j++) {
d3.select("#" + String(carrier_colors2[j].value.circle_id)).style("visibility", toggle ? "hidden" : "visible");
}
d3.select('#circletext').style("visibility", toggle ? "hidden" : "visible");
} else {
// Hide or show circle and circletext
d3.select("#" + String(carrier_colors2[(carrier_colors2.map(function(v) {
return v.key})).indexOf(carrier_list[i])].value.circle_id))
.style("visibility", toggle ? "hidden" : "visible");
// Because Pinnacle carrier code 9E starts with a number
if (carrier_list[i] == "Pinnacle") {
d3.select('[id="9E"]')
.style("visibility", toggle ? "hidden" : "visible");
} else {
d3.select("#" + String(carrier_colors2[(carrier_colors2.map(function(v) {
return v.key})).indexOf(carrier_list[i])].value.circletext_id))
.style("visibility", toggle ? "hidden" : "visible");
}
}
// Update toggle
toggle = !toggle;
})
})(i); // end of function(i)
} // end of for (var i
} // end of if loop
}, 500); // end of year_interval
}; //end of drawBubbles function
</script>
</head>
<body>
<h1> US Carriers Improve Arrival Performance Year-on-Year with a Dip in 2013 and 2014 </h1>
<div id="chart" style="width:800px; margin:0 auto;"></div>
<div id="click_buttons_text" style="width:800px; margin:0 auto;" ></div>
<div id="vis" style="width:800px; margin:0 auto;"></div>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript">
/* Load data */
// Parse YEAR
var parseDate = d3.time.format("%Y").parse;
d3.csv("BubblePlotData_Yne.csv", function(d) {
return {
YEAR : parseDate(d['YEAR']).getFullYear(),
CARRIER : d['CARRIER'],
carrier_names: d['carrier_names'],
carrier_shortnames: d['carrier_shortnames'],
ontime_arr_pct : +d['ontime_arr_pct'],
delay_arr_pct : +d['delay_arr_pct'],
total_flights : +d['total_flights']
};
}, drawBubbles);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment