November’s Numbers: U.S. Political Trends, Visualized

The 2024 U.S. presidential election offers a rich dataset for data scientists to explore. Using the open-source Python libraries Panel, hvPlot, and HoloViews we created visualizations like Sankey diagrams, heatmaps, and box charts to illustrate key political dynamics, including voter turnout, partisan divisions, and swing state competitiveness. Explore the code used to build these visualizations in Anaconda Notebooks.

These visualizations reveal patterns such as regional disparities in turnout and shifts in issue-based support, offering valuable insights into U.S. politics. Beyond elections, this project demonstrates how combining datasets and advanced visualization tools can simplify complex data, uncover actionable trends, and deliver impactful narratives for businesses and organizations.

We sourced data for this project from the following:

Trump’s Electability

Using data from AP VoteCast, we built a custom Sankey diagram app with HoloViews. Explore our dynamic Sankey app here and create your own analysis.

Sankey diagrams are excellent tools for visualizing the relationships between two or more categories, making it easier to understand proportions, patterns, and the movement of values within a system. The app visualizes the responses to two questions:

  • PARTYFULL: “Do you lean toward Democrats, Republicans, or neither?”
  • TRUMPTRAITSWIN: “Can Donald Trump win the general election in November?”

On the question of whether Trump can win the general election, Republicans overwhelmingly exude confidence, with the majority believing he can succeed. Democrats, on the other hand, are largely skeptical, leaning heavily toward “No.” Independents, unsurprisingly, are split, mirroring their position as political wild cards.

The left side of the diagram represents respondents’ political leanings, grouped into “Republican/Lean Rep,” “Independent,” and “Democrat/Lean Dem.” The right side indicates their responses to whether Trump can win, categorized as “Yes” or “No.”

MAGA and Education

One interesting post-election data point that’s been widely discussed is the relationship between education and support for the Make America Great Again (MAGA) movement.

The education Sankey diagram confirms this trend: support for the MAGA movement varies across educational attainment levels. Those with a high school education or less are more likely to support MAGA, while postgraduates tend to oppose it. College graduates, notably, show a near-even split between “Yes” and “No,” highlighting diverse perspectives within this group.

One surprising detail is the presence of postgraduates who support MAGA—a smaller segment, but one that challenges assumptions about the movement’s alignment with education levels. This could suggest a more ideologically diverse base within the MAGA movement than commonly perceived.

This Sankey diagram visualizes responses to two questions:

  • EDUC: “What is your highest level of education?”
  • MAGA: “Do you support the MAGA (Make America Great Again) movement?”

The left side of the diagram represents respondents’ education levels, grouped into “High school or less,” “Some college/assoc. degree,” “College graduate,” and “Postgraduate study.” The right side indicates their response to MAGA, categorized as “Yes” or “No.”

Trump and Gender

When gender enters the equation, a clear divide emerges. Men are more likely to have a more favorable view towards Trump than women are. However, what’s surprising is that while a higher proportion of men have a favorable view of Trump, more than half of women hold a favorable view of him, too—despite being critiqued for his polarizing rhetoric around gender and women’s issues.

Even more surprising is the response from nonbinary and other genders. While this is a small group, their opinions seem evenly spread, showing no overwhelming consensus on Trump’s favorability based on gender.

This Sankey diagram visualizes responses to two questions:

  • GENDER: “What is your gender?”
  • FAVTRUMP: “What is your favorability of Donald Trump?”

The left side of the diagram represents respondents’ gender, grouped into “Men,” “Women,” and “Nonbinary/Other.” The right side indicates their response to MAGA, categorized as “Yes” or “No.”

Foreign Aid: Ukraine vs. Israel

The 2024 election saw the question of foreign aid shape the political discourse in the nation, namely military and financial support—or lack thereof—for both Ukraine and Israel.

This diagram paints a vivid picture of how political affiliation shapes views on foreign aid. Democrats strongly favor aid to both Ukraine and Israel, showing a consistent stance. Republicans, meanwhile, oppose aid to Ukraine while strongly favoring aid to Israel—a divide that reflects the geopolitical narratives emphasized in conservative politics.

What’s particularly interesting is the flow between the Ukraine and Israel categories. Some respondents who “Strongly oppose” aid to Ukraine still favor aid to Israel, reflecting differing perceptions of the two conflicts and their importance to U.S. interests.

This Sankey diagram visualizes responses to three questions:

  • UKRAINEAID: “Do you favor or oppose the U.S. providing aid to Ukraine?”
  • PARTYFULL: “Do you lean toward Democrats, Republicans, or neither?”
  • ISRAELAID: “Do you favor or oppose the U.S. providing aid to Israel?”

The diagram is divided into three sections. The left side shows respondents’ stance on Ukraine aid, categorized as “Strongly oppose,” “Somewhat oppose,” “Somewhat favor,” or “Strongly favor.” The center represents political affiliations: “Republican/Lean Rep,” “Democrat/Lean Dem,” and “Independent.” The right side indicates respondents’ stance on Israel aid, categorized as “Strongly oppose,” “Somewhat oppose,” “Somewhat favor,” or “Strongly favor.”

Voter Turnout: Presidential vs. Midterm Elections

Using data from the University of Florida’s Election Lab, this plot tells a story of how voter turnout in the United States has evolved over more than two centuries, highlighting distinct differences between presidential and midterm elections. It offers a lens into the dynamics of civic engagement and how historical, social, and political contexts shaped voter participation.

Presidential elections (blue line) consistently see higher turnout rates compared to midterm elections (red line). This trend underscores the heightened public interest and stakes typically associated with electing a president versus congressional contests. However, the plot also reveals several fascinating shifts based on the history of the United States:

  • The Rise in Turnout (1800s): Early in the 19th century, voter turnout was generally low, but it rose sharply in the 1820s-1840s, particularly for presidential elections. This reflects the broadening of voting rights during this era, such as the removal of property requirements for white male voters.
  • The Peak and Decline (Late 1800s to Early 1900s): Turnout peaked in the late 19th century, especially for presidential elections, before falling dramatically around 1920. This period corresponds with significant political changes, such as the expansion of suffrage to women (19th Amendment) and shifts in party systems. The drop in turnout during the early 20th century might also reflect voter fatigue from political realignments and systemic barriers like Jim Crow laws.
  • Mid-20th Century Stabilization: After 1920, turnout for both presidential and midterm elections stabilized at lower levels. This coincided with the entrenchment of modern political institutions and changes in voter mobilization strategies.
  • Modern Trends (Post-1950): In the latter half of the 20th century and into the 21st, turnout rates for both election types gradually improved, particularly for presidential elections. This resurgence likely reflects the impact of the civil rights movement, the Voting Rights Act of 1965, and ongoing efforts to engage younger and minority voters.

What’s most interesting about this graph is that it shows how we’re approaching an all-time high of voter participation. In fact, data from the National Association of Counties found that the 2024 cycle had the second highest voter turnout (63.3 percent) since 1960, only topped by the 2020 election (66.7 percent).

2024 General Election VEP Turnout Rate

While modern voter turnout is higher than ever, regionally it’s a different story. 

This map visualizes the turnout rates for the voting eligible population (VEP) in the 2024 general election across the United States. Each state is color-coded based on its turnout rate, ranging from purple (low turnout) to yellow (high turnout).

Key Observations:

  • Highest Turnout (Yellow): Minnesota and Wisconsin in the Midwest stand out for their high turnout rates. These states are often recognized for strong civic engagement, easy voting access, and competitive elections that energize voters.
  • Lowest Turnout (Purple): States in the South, such as Mississippi and West Virginia, show the lowest turnout rates. This aligns with historical trends where factors like onerous voting processes, socioeconomic challenges, or disengagement have contributed to lower participation.
  • Moderate Turnout (Green and Blue): States in this range may have reasonably strong voter engagement but lack the higher rates seen in the Midwest or competitive battleground regions.
  • Regional Patterns: The Midwest consistently shows higher turnout compared to the South, with the West displaying varied levels. This regional disparity often reflects a mix of local election laws, accessibility, and the political environment.

Number of Swing States (Margin ≤ 3%) by Year

The most surprising aspect of this trend is how the number of swing states has plummeted in recent decades, despite the perception of close national elections. This reflects how deeply entrenched partisan loyalties have become, with fewer states flipping between parties, even as the overall national margin remains competitive. It also underscores the growing importance of a small number of battleground states in determining the outcome of presidential elections.

This line chart tracks the number of swing states in U.S. presidential elections from 1960 to 2020, where swing states are defined as those decided by a margin of 3% or less. The trend reveals the gradual decline in the number of competitive states over time, reflecting broader shifts in the polarization of the U.S. electorate.

Key Observations

  • 1960s Peak: The 1960 election shows the highest number of swing states, reflecting a highly competitive electoral landscape during a period of significant political realignment and close elections.
  • Decline in the 1970s and 1980s: The number of swing states dropped sharply in the early 1970s and remained low through the 1980s. This period corresponds with landslide elections, such as Nixon’s in 1972 and Reagan’s in 1984, where one party dominated.
  • 1990s Resurgence: The 1990s see a moderate increase in swing states, likely due to the competitive nature of the elections during the Clinton era, as well as the presence of third-party candidates such as Ross Perot.
  • 2000–2020 Polarization: The number of swing states declines again, especially in the 2000s and 2010s, reflecting increasing partisan polarization. By 2020, the number of swing states is among the lowest, with most states reliably leaning toward one party or the other.

Comparing the Two Visualizations: Margin of Victory Across States

These two plots complement each other by showcasing the variation in electoral margins of victory across U.S. states over time, but from different perspectives.

The heatmap offers a year-by-year view, with darker shades representing closer races and lighter shades indicating less competitive elections. It highlights key battleground states like Wisconsin and Michigan, solidly partisan states like Wyoming and Massachusetts, and shifting dynamics in states such as Virginia and Georgia.

The box plot summarizes the range of margins in each state across years, with wider plots in states like Florida indicating fluctuating competitiveness, and narrower ones in states like Wyoming showing consistent partisan loyalty. Color-coded election years reveal trends, such as smaller margins in recent elections for Georgia and Arizona, emphasizing their emergence as swing states.

Together, these visualizations reveal the balance between stability in some states and evolving competitiveness in others, reflecting broader trends in political polarization and demographic shifts.

Conclusion: Turning Data Insights into Action

The techniques and visualizations showcased in this blog illustrate how combining datasets with advanced tools like hvPlot, HoloViews, Panel, and Anaconda Notebooks can uncover meaningful patterns and drive impactful narratives. While the focus here has been on U.S. election data, these methods have broad applications for businesses and organizations. 

Whether navigating competitive markets or analyzing team performance, visual tools like Sankey diagrams, heatmaps, and temporal plots help stakeholders see the bigger picture. By adopting these techniques, your organization can elevate its data analysis capabilities, enhance collaboration, and turn raw information into a strategic advantage.

Learn more about how Anaconda inspires innovation through data science and AI on our website

Talk to an Expert

Talk to one of our experts to find solutions for your AI journey.

Talk to an Expert