Today’s political landscape is often dismissed as a partisan deadlock in which the vast majority of voters have already made up their minds and will only dig their feet in further with each passing news cycle. And the data speaks for itself: People seemed to choose party over candidate in 2018, and districts largely voted as expected, based on their previous voting habits and the national environment. Democrats won the House national popular vote by about 8.5 points and the margin in the two-party vote for House swung, on average, about 5 points toward Democrats, a continuation of a leftward swing that started in 2016.

But when you focus on how predictably Republican or Democratic a district is, you may miss the fact that a district’s partisanship can — and does — change over time. To better understand how partisanship is shifting at the district level, we looked at each House election since 2012 and calculated the difference between each party’s share of the two-party vote — that is, each party’s votes as a share of all the votes cast for one of the two major parties, disregarding any votes for third parties, independent candidates or write-ins. (We excluded any districts that had been redrawn at any point since 2012 election, which meant ignoring all of Pennsylvania, for example, as its districts were redrawn by a court earlier this year. ) Overall, we were able to calculate the margin of victory for 371 districts in at least one of the four election cycles.

In the chart above, each dot represents a district’s margin in that year’s election, and the lines between them connect that district across the years, showing its changes in direction over time. As you can see, some of the districts where Democrats picked up seats in 2018 were previously pretty Republican-leaning — you can see the Democratic gains in those sharply angled blue lines sweeping across the central divider. Among those flipped districts are places that have long Republican traditions, like suburbs in Georgia, Texas and California that haven’t been represented by a Democrat in recent years. Looking at all the districts that flipped to Democrats this year, the average margin has shifted nearly 19 points to the left since 2012.

Only two districts in our data set flipped from Democrats to Republicans this year. One of those districts, the Minnesota 8th, had been represented by Democrats for 68 of the last 70 years.

Newfound Democratic strengths that were often overlooked in the post-2016 analysis came to the fore in the 2018 midterms. One of the most dramatic examples is the way college-educated voters grew even more Democratic.

We grouped districts into percentiles by what percentage of the population of adults over 25 had a bachelor’s degree, and then selected the top 10th percentile and the bottom 10th percentile. Districts in the top 10th percentile took a limited swing to the right in 2014, then moved to the left in each subsequent election. In 2018, this group swung to the left by an average of 18 points, which far outpaced the national average of a bit under 5 points. Overall, out of the 38 districts in the top 10th percentile for residents with a bachelor’s degree, the number of Republican-controlled districts has winnowed from 17 to just seven.

But the story is less clear-cut in districts in the bottom 10th percentile for population with a bachelor’s degree — 14 went Democratic this year and 16 went Republican. And that’s due in part to the role race can play in determining how a district votes. While there is evidence that white voters without a bachelor’s degree have swung right in recent years, we haven’t seen the same movement among nonwhite voters without a bachelor’s degree. Of the districts in the bottom 10th percentile by education, 31 were majority white, six were majority nonwhite and one was about evenly split. They span a pretty broad spectrum, from New York’s 15th Congressional District, which is 82 percent nonwhite, to Kentucky’s 5th, which is 97 percent white.

Partisan differences along race lines aren’t new in America, but trends over the past six years in the districts with the largest and smallest white populations show a widening gulf. That was most apparent in 2016, when districts with the largest shares of white residents drove farther to the right by 5 points. At the same time, the least-white districts swung in the opposite direction — 9 points to the left.

In 2018, the whitest districts moved back to the left somewhat, but their average vote share margin still stands to the right of where it was in 2012. That serves as a contrast to the nation as a whole, which, on average, has moved slightly to the left since then. In 2012, 11 of the country’s 38 whitest districts were controlled by Democrats, but today that number has shrunk to six. All but two of the 38 whitest districts in our data set fall into the “pure rural” or a “rural-suburban mix” categories that CityLab created to group congressional districts by how densely populated they are. This extreme drought in heavily white, sparsely settled areas highlights the problem Democrats face when trying to compete outside their traditional strongholds.

Factors like race and educational attainment are driving shifts in partisanship and changing where on the electoral map the each party dominates and where the two parties are competing for control. Those places could hardly be more evident: Democrats are dominating high-density places, like cities and heavily populated suburbs, while Republicans are dominating low-density places — much of rural America, in other words.

Districts with an urban-suburban mix are one of the best examples of Democrats’ dominance in denser areas. These districts have been moving further left than the nation as a whole over the past three election cycles, and now they stand an average of 9 points to the left of where they were in 2012. Not one of the districts in our data set that fell into that category was won by a Republican in 2018, and the GOP lost control of a number of seats it had previously held, including districts in Orange County, California, and Harris County, Texas (the home of Houston).

Rural districts, on the other hand, are a mirror image of the urban-suburban group. They shifted to the right in 2014 and have stayed put even as the nation as a whole has shifted to the left. In 2012, Democrats controlled 12 of these rural districts, but after the 2018 midterms, that number is down to just seven, and the few they hung on to include districts such as Vermont’s at-large seat and South Carolina’s 6th District, which is majority nonwhite.

The idea that partisanship is increasingly driving Americans’ political behavior is, of course, true. But leaving it at that skims over some interesting aspects of the landscape today. Distinct groups of people, living in distinct parts of the country, are shifting their preferences and shifting the electoral map along the way. In 2016, Democrats lost in places that, four years before, they would never have imagined they could lose. In 2018, the same thing happened to Republicans. In all likelihood, 2020 will bring its own surprises. Will recent racial, class and regional trends continue? If they do, we could be looking at a new American political map before too long.