Histomap of Magic the Gathering

During my third semester in CUNY’s Data Visualization and Analysis program, I conducted a study on keyword data in Magic the Gathering cards, a popular collectible card game. Alongside my fascination with movie data, Magic the Gathering has a significant influence on my thoughts – many hours have been lost to deck building and gameplay videos. More importantly, Magic has provided the opportunity for me to regularly cook for my friends and enjoy Friday nights filled with gameplay.

Histomap of MTG

If you’re a Magic player (or not) and have suggestions for improvements please let me know in the comments. Also below is the full white paper submitted as part of the assignment. As this is my first attempt at creating this type of document, I hope it proves helpful to those who are interested in delving into the details of the visualization’s inspiration and the process of building it.

Introduction

The Histomap of Magic the Gathering” presents the history of the Standard format of the collectible card game Magic the Gathering by analyzing keywords and visualizing the data in a normalized streamgraph. This visualization showcases the evolution of word usage over time, highlighting the growth and stability of “evergreen” keywords and identifying those that didn’t become established as evergreen. This information may provide insights into the historical descriptions of archetypes during each Standard. The streamgraph of stacked areas created for each keyword is particularly useful for identifying trends and patterns over time.1 The adoption of a vertical format for the streamgraph is inspired by John B. Sparks’s 1931 “The Histomap: Four Thousand Years of World History,” a 13″ x 63″ poster-sized visualization that showed the relative power of contemporary nations, states, and empires.2 However, unlike Spark’s presentation, for this web-based visualization, users must scroll along the vertical axis with only a particular window of time viewable.

Spark’s Histomap, 1931, detail2

The Standard format, also known as Type II, was introduced in 1995 as a competitive format where players construct decks using only the most recent sets of cards. Over the years, 113 sets with over 21,000 unique cards have rotated through the format, creating new “Standards” unique to the pool of cards allowed. A Standard comprises anywhere between 3 and 10 sets, with a rough average of 1500 cards. Cards can have keywords that fall into three types: keyword actions, keyword abilities, and ability words. In this study’s visualization, there is no categorical differentiation made between keyword types, though a tooltip does note it.

Study Data

To gather the data for each Standard’s time periods and card sets, a dataset was scraped from the MTG community wiki hosted on mtg.fandom.com, specifically using the Standard/Timeline page.3 The date format used by the authors of the wiki varied between month day, year; month, year, and even month/month year. The first day of the month and/or the first month of pairs was used to standardize the date format. The set names listed for each time period also had various formats, including abbreviations and ‘colloquial’ names. Each set name was standardized into its unique three-character identifier. For example, in the data, the set “Ikoria: L.O.B.” has the full name “Ikoria: Lair of Behemoths” and was coded as “iko”. The final Standard data structure includes a specific start day, month, and year, and a list of set codes.

Card data for each set was gathered from scryfall.com, which has an API to collect card data in a JSON format. The ‘Default Cards’ JSON file, containing every card object on Scryfall in English, was downloaded on 04/17/2023.4 The date is noted as the database changes with each set release and updates to card data. The card data was reduced and sorted to include card objects that matched the three-character “set” from the Standard dataset.

A Scryfall card object includes a “keywords” entry with a list of keyword values. For example, “Lord of the Forsaken” has a list of three keywords:

"keywords": [
"Flying",
"Trample",
"Mill"
]

It should be noted that the full oracle text of “Lord of the Forsaken” includes the keyword action “Sacrifice,” which is not coded into the card object’s keyword list. There are a total of 21 keyword actions5, 6 that are not coded into card objects by Scryfall. An attempt to contact the database publisher was made to ascertain the rationale for these exceptions, but a response was not received. It is hypothesized that excluded words such as “cast,” “discard,” “search,” “shuffle,” “exile,” and “destroy” are so fundamental to the original game rules that they are not coded. For this study, these keyword actions are not included.

There are six keywords7 that have several syntactic differences, although they fall under the same rules mechanic. These keyword groups were re-coded under a single keyword. For example, the keywords ‘Swampwalk’ and ‘Forestwalk’ were re-coded under the general keyword ‘Landwalk.’

For each Standard, the card objects from all sets were combined, and any duplicates found by card name were removed. The keyword lists of all card objects were merged, creating a list of unique keywords. A count of each unique keyword was tallied for the complete list of card objects in a given Standard. These data, along with the Standard start date, are the three core data points needed for building the streamgraph: keyword name, keyword count, and Standard start date. For example:

{
"date": "1995-01-10T05:00:00.000Z",
"keyword": "Flying",
"count": 26
}

Finally, the data included in keyword tooltips, which describes the rules of the keyword, was scraped from the MTG community wiki. This was done using the unique URL8 for each keyword and compiling data from each page.

Design

The design of the streamgraph was based on Mike Bostock’s “Stacked Area Chart, Normalized”9 using the d3.js chart-building JavaScript library.

Bostock Sample Stacked Area Chart10

and the y-axis (quantity). Normalization of quantities between 0 and 100% is achieved using the d3 stackOrderOffsetExpand method. The default chart layout reads horizontally, with time on the x-axis and quantity on the y-axis. However, for this study, these values are swapped in the area function to create the vertical layout.

The height of the chart relative to the width was set to allow for the viewing of 3-5 Standards within a browser window. This size also accommodated the display of additional data based on each Standard period.

A categorical color palette was used to differentiate keywords, utilizing ten colors from the d3.schemeTableau10 palette.11 Five of these colors closely align with the palette of the Spark’s Histomap creating an appropriate tribute to the influential visualization. With over a hundred keywords in the study, colors are repeated, serving only to visually separate adjacent streams.

Tableau10 palette.12

Several custom features were implemented to assist users in interpreting the streamgraph. Hovering over a stream displays a tooltip with data such as the keyword name, the count of cards using the keyword throughout the history of Standard, and the dates of the sets in which the keyword first and last appeared. A simple definition of the keyword’s function in the game is also provided.

Users can select a keyword stream, highlighting it while dimming all other streams. This feature enables users to track a specific keyword’s share of a Standard throughout the visualization. Evergreen keywords will have a continuous presence on the chart, while others will appear as narrow slices during specific time periods.

Icons representing each set within a Standard are included on the y-axis label, along with the start date indicated by month and year. Hovering over the label reveals a semi-transparent block that covers the streamgraph, delineating the area corresponding to the particular Standard’s period. Additional information is provided, including the icons and names of each set, the count of cards in the Standard, the number of unique keywords, and any new keywords introduced for the first time in that Standard. This data allows users to gain insights into the evolution of keyword usage throughout the format’s history. The block can be pinned or unpinned to view data for multiple Standards.

Six informative cards with analysis of the visualization are presented at various points atop the streamgraph. Users can dismiss or move these cards to interact with the streams and Standard block data in the chart. The cards discuss changes in keyword quantities over the history of the format and highlight notable keywords for their impact on the game.

Conclusion

Overall, the visualization provides an engaging way for users to explore the dynamic use of keywords in Magic the Gathering’s Standard format. Notably, keyword introductions began to be associated with set themes, leading to a regular pattern of rotating groups of words entering and exiting the format. Occasionally, keywords are added to the list of evergreen keywords, but more commonly, there are visible peaks of keyword additions and valleys of keyword exits.

For future research, it might be interesting to attempt to count the uncoded keyword actions by searching for them in the card objects’ oracle text. However, given their ubiquity in the game, including them may overwhelm the chart and reduce the visibility of rotating keywords. Additionally, creating a printed chart of the visualization as a tribute to Spark’s work and as a unique object would be appealing.

Footnotes

1 Havre, Susan, Elizabeth Hetzler, Paul Whitney, and Lucy Nowell. “ThemeRiver: Visualizing Thematic Changes in Large Document Collections.” P 18. IEEE Computer Society.
2 Sparks, John B. Broadside of “The histomaps, four thousand years of world history; relative power of contemporary states, nations, and empires …”, 1931, Yale University Library, collections.library.yale.edu/catalog/2025152. Accessed 18 May 2023.
3 “Standard/Timeline – Magic: The Gathering Wiki.” MTG Wiki, mtg.fandom.com/wiki/Standard/Timeline. Accessed 18 May 2023.
4 “Scryfall API Documentation.” Scryfall, scryfall.com/docs/api/bulk-data. Accessed 17 Apr. 2023.
5 “Keyword action – Magic: The Gathering Wiki.” MTG Wiki, mtg.fandom.com/wiki/Keyword_action. Accessed 18 May 2023.
6 List of missing keyword actions: 701.2. Activate, 701.3. Attach, 701.4. Cast, 701.5. Counter, 701.6. Create, 701.7. Destroy, 701.8. Discard, 701.9. Double, 701.10. Exchange, 701.11. Exile, 701.14. Play, 701.15. Regenerate, 701.16. Reveal, 701.17. Sacrifice, 701.19. Search, 701.20. Shuffle, 701.21. Tap and Untap, 701.24. Planeswalk, 701.25. Set in Motion, 701.26. Abandon, and 701.32. Vote.
7  List of keywords with syntactic variations: Cycling, LandWalk, Hexproof, Kicker, Morph, Daybound/Nightbound.
8 There are over one hundred keywords to be cited, but all follow a common format based on the keyword name. This is a sample: “Cast.” MTG Wiki, mtg.fandom.com/wiki/Cast. Accessed 18 May 2023.
9, 10 Bostock, Mike. “Normalized Stacked Area Chart.” Observable, observablehq.com/@d3/normalized-stacked-area-chart. Accessed 18 May 2023.
11, 12 Color Schemes.” Observable, observablehq.com/@d3/color-schemes. Accessed 18 May 2023.


Posted

in

,

by