A Visualization of Airline Mergers
I recently embarked on a project to visualize airline mergers in the US using the D3.js data visualization library. My initial goal was simple - have ChatGPT help me generate a timeline view of major US airlines and their merger relationships over the decades. I thought it would be pretty straightforward, as I’ve had a lot of success using ChatGPT to generate JavaScript for other projects and even make iOS applications. In my head, the task was simple: create a JavaScript visualization with the following characteristics:
- Time is on the vertical axis, progressing as you scroll down.
- Each airline is plotted as a line, starting on their foundation/initial operations date.
- Mergers or partial acquisitions should be depicted as horizontal lines between two (or more) airlines’ lines.
Simple, no? Well, it was not. But before we get into the problems, let’s look at the end product.
As I alluded to earlier, this project could have been more straightforward. The creation of the above viz was more complex and nuanced than I had initially envisioned.
Unexpected Complexity
ChatGPT balked at the pretty consistently when asked to help generate the viz. This balking was surprising. Usually, with the proper prompts and chaining, I can get ChatGPT to code up something resembling my aim. However, ChatGPT kept saying the task was too complicated, even with significant coaching.
It took me a while to believe ChatGPT, but I eventually realized that this was way more complicated of an ask than I had initially envisioned. This was because the data were a lot more complicated. Many airlines have existed over the past century, some popping in and out of existence multiple times (see Frontier and Western), and they often have convoluted relationships with one another. Defining what constituted an “airline” became tricky - early airmail carriers that later entered passenger service looked very different than modern airlines. I got ChatGPT to generate some starting data by limiting the timeframe (last 50 years) and airline definition (major airlines). This yielded a template that I could begin to build out manually.
Additionally, the visualization wasn’t a straightforward plot and was hard to describe to ChatGPT. Initially, I wanted something like a flow diagram or a Sankey plot to show fleet sizes over time. But this was an added level of complexity and data that wasn’t feasible. I retreated on this front and used this “lane diagram” paradigm.
Finally, I had ChatGPT generate about half of the data presented. As I started manually adding airlines and relationships, I had to “modify” existing data that ChatGPT had generated. Most of the time, this wasn’t because ChatGPT was making up stuff, but it had interpreted a relationship or a founding date differently. Checking all the data is difficult - this is an interesting “failure mode” of using an LLM in this project. Many of the facts look right, but if you need guarantees about the accuracy, you’ll need ways to double-check. And that’s a manual process (look stuff up on Wikipedia) for this project.
Evolution of Aviation
Despite the complexity, the end visualization effectively captured distinct eras in the evolution of US aviation. We see the early days of airlines with myriad airmail carriers, like Varney, and other small companies, like Huff Daland Dusters. The visualization shows how these little companies were aggregated into the “Big Four” airlines (American, Eastern, TWA, and United) that dominated the industry after the 1930 Spoils Conference. And it shows the proliferation of new entrants following deregulation in 1978.
Today, the industry has consolidated down to three major legacy carriers - American, Delta, and United - all of whom can trace their history back to early airmail operators. The visualization indirectly hints at how the airline business transformed into a significant financial and logistics enterprise over the decades.
The current viz encapsulates many impactful events and relationships that shaped commercial aviation. But there are still areas for improvement.
Refining the Visualization
I’m not 100% done with this project, but in this spirit of “shipping” often, I’ve decided to release this version. However, there are several ways I want to improve this project:
- Add More Airlines: The current graphic does not encompass all airlines. I could expand it to include more regional and early operators.
- Enrich Data: The visualization would be more informative if each airline timeline incorporated additional data like the number of routes, fleet size, etc.
- Refactor Code: I would like to refactor the viz so that the data is separated from the HTML displaying the viz. Then, it could be queried in different ways.
- Improvement of Viz: Every airline has its “own lane” right now. This means that horizontal space is used suboptimally, as we could have airlines that don’t overlap temporally share the same vertical space.
- Autolayout: I manually tweaked the layout of the viz for aesthetic purposes. We could mathematically encode our viz constraints and design objectives and then use mathematical programming techniques to get a nice viz without any manual tinkering.
- Explore New Visual Encodings: With the data extracted, I could try different visualization types like Sankey diagrams or flow charts to represent relationships.
The viz code lives in a separate HTML file in a public Airline Mergers GitHub repository. I’ll create new refined visualizations in that directory and post about them as soon as I have time.
I’m excited to continue refining this airline merger visualization project. It was an excellent d3.js learning experience. Please let me know if you have any other ideas for improving the graphic or applying this approach more broadly!
Bonus: This Type of Viz in Medicine?
I think this visual could summarize various parts of patient trajectories. For example, it relates to how anesthesia EMRs display their intra-operative infusions. But is there any way to use the “merging” functionality?
Another use could be the interactive visualization of anatomical structures with branching and merging patterns, like nerves and vasculature. I might try making a version of the brachial plexus with this code.
Final thoughts: you could use this to represent healthcare organization mergers. Maybe that’s another project I’ll start in the future.
Cheers,
Erkin
Go ÖN Home