In most states, district maps — which define where the constituency of one representative ends and that of another begins — are drawn by the state’s lawmakers. Having politicians define their own districts has not gone entirely smoothly — and two cases involving political gerrymandering, or the drawing of districts (especially oddly shaped districts) to favor one party over another, are now before the U.S. Supreme Court.

But if gerrymandering is a bad way to draw districts, what happens when you try other ways? At FiveThirtyEight, we’ve been exploring this and other questions in “The Gerrymandering Project.”

As part of this project, we set out to determine what districts for the U.S. House of Representatives could look like if they were drawn with different goals in mind. We did the drawing ourselves … 258 state congressional maps, or 2,568 districts, sketched out over the course of months, with the indispensable help of one developer’s free online redistricting tool.

We looked at seven different ways of drawing congressional districts for the entire country — from pretty fair to seriously gerrymandered. See how the makeup of the U.S. House changes with each map »

No single map can fulfill all the criteria we looked at — more competitive elections or more “normal-looking” districts, for example. Depending on the desired outcome, each of the different maps could represent the “right” way to draw congressional district boundaries. If you haven’t explored the maps in our Atlas Of Redistricting yet, we hope you’ll do that now. Below are the details of how we made and analyzed all of them.

Eight ways to draw a district

Our atlas includes eight different congressional maps of the entire country. Each of those eight maps is made up of a distinct set of 43 state maps (seven states can’t be redistricted because they have only one congressional district that spans the entire state). The first set of maps is:

The current congressional boundaries

We made each of the other seven with a different goal in mind:

2. Gerrymander districts to favor Republicans

3. Gerrymander districts to favor Democrats

4. Match the partisan breakdown of seats to the electorate

5. Promote highly competitive elections

6. Maximize the number of majority-minority districts

7. Make district shapes compact (using an algorithm)

8. Make districts compact while following county borders

We drew six of these sets by hand — Nos. 2-6 and No. 8 — using a tool called Dave’s Redistricting App (more on that later). The districts for No. 7 were designed by a software engineer named Brian Olson.

All of the hand-drawn maps follow two simple rules: Each district must be contiguous, meaning that all parts of the district touch each other, by water or by land. And each district must be within 1,000 residents of the state’s “ideal” district population — the total population in 2010 divided by the number of districts — to satisfy the legal requirement that districts be equally populous.

Before we get into the specifics of each type of map, here are some more overarching guidelines we followed, for both the map-making and the analysis. When considering partisanship — some maps were drawn with specific partisan aims, and we calculated the partisanship of every district in every map — we used the Cook Political Report’s Partisan Voter Index. PVI measures how much more Democratic or Republican a district voted relative to the national result in an average of the last two presidential elections. We categorized partisanship into three “buckets”:

Usually Democratic districts (those with an estimated PVI score of D+5 or higher — in other words, at least 5 percentage points more Democratic than the nation)

Competitive districts (those with an estimated PVI score between D+5 and R+5)

Usually Republican districts (those with an estimated PVI score of R+5 or higher)

But we didn’t stop there. We also used congressional results from 2006 to 2016 to figure out how often a Democrat or Republican wins a district with a given PVI. In effect, we translated PVI into either party’s chance of winning the seat in question (more on this below).

When considering race, we used voting age population data from the 2010 census. Many courts have considered citizen voting age population as a legal standard to evaluate districts. However, the decennial census does not report citizenship status, and we considered voting age population the best, most readily available metric for our purposes. We categorized districts into five race buckets:

Non-Hispanic white majority

African-American majority

Hispanic/Latino majority

Asian/Pacific Islander majority

Coalition, or majority-nonwhite (no single majority group)

We drew all but two of our seven maps to comply with the Voting Rights Act by preserving the majority-minority status (though not necessarily the exact boundaries) of all 50 current districts where one minority group constitutes a majority of the voting age population. However, our two “compact” maps (the one that follows current county borders and the algorithmically drawn one) disregard the Voting Rights Act to demonstrate what districts might look like if they were drawn to maximize compactness on a race-blind, party-blind basis.

In some cases, a single map met more than one goal. For example, California’s Republican gerrymander map also fits our criteria for a proportionally partisan map, so they are the same. Some maps weren’t possible because of political or racial realities — i.e., a majority-minority map of New Hampshire or a Republican gerrymander of Hawaii. In those few cases, we drew a map that came as close as possible to meeting the approach’s objective.

Here’s a bit more detail on each map:

1. Current districts

These are the congressional districts currently in effect for the 2018 elections. The probabilities listed on this map do not reflect predictions for the 2018 election specifically, but instead are how often we’d expect each party to win the seat over the long term based on its Cook PVI across a variety of political conditions.

2. Republican gerrymander

This map seeks to maximize the number of usually Republican districts — those with a Cook PVI of R+5 or greater (which we’ve found corresponds to at least an 82 percent chance of a Republican victory). Where additional strongly Republican districts are not possible, this map seeks to maximize the number of competitive districts (Cook PVI between D+5 and R+5). Think of these maps as extreme Republican gerrymanders — a reference point for how far Congress could be pushed to the right.

3. Democratic gerrymander

This map seeks to maximize the number of strongly Democratic districts (Cook PVI of D+5 or greater). Where additional strongly Democratic districts are not possible, this map seeks to maximize the number of competitive districts (Cook PVI between D+5 and R+5). Think of these maps as extreme Democratic gerrymanders — a reference point for how far Congress could be pushed to the left.

4. Proportionally partisan

This map seeks to draw districts that favor each party in proportion to the overall political lean of each state. For example, if a state has 10 districts and Republicans won an average of 70 percent of its major-party votes in the last two presidential elections, we drew seven districts to favor Republicans and three to favor Democrats.

5. Highly competitive

This map seeks to maximize the number of highly competitive districts — those with a Cook PVI between D+5 and R+5. In terms of probabilities, that means both parties have at least an 18 percent chance of winning these seats.

6. Majority minority

This map seeks to maximize the number of districts where members of a single minority group make up a majority of the voting age population. Because of lower rates of citizenship among Latinos, the map strives to create 60 percent Hispanic/Latino districts where possible. Where additional majority-minority districts are not possible, the map seeks to maximize “coalition” districts where no racial group makes up a majority.

7. Compact (algorithm)

This map is based on Olson’s computer algorithm, which seeks to minimize the average distance between each constituent and his or her district’s geographic center. It is the only set of state maps (other than the current congressional boundaries) that we did not draw by hand. It is based on census blocks and is blind to race, party and higher-order jurisdictional boundaries like cities and counties. It makes no attempt to adhere to the Voting Rights Act.

8. Compact (borders)

This race-blind and party-blind map seeks to maximize compactness by using counties as building blocks when drawing districts. The map splits counties only as many times as necessary to create equally populous districts, and where possible, entire districts are kept whole within counties, metro areas and regions. When counties are split, the map seeks to minimize splits of county subdivisions, such as cities and townships. It makes no attempt to adhere to the Voting Rights Act.

How we drew all those districts

Between June 2017 and January 2018, we drew 258 congressional maps for this project using Dave’s Redistricting App, a free, web-based, do-it-yourself redistricting application created by software engineer Dave Bradlee. Bradlee, who launched the app in 2009, made this project possible by helping us update his app with election results from 2012 and 2016.

Before we started work on the atlas, Dave’s Redistricting App already had data on population and race, which we used to draw the maps that did not take partisanship into account (the majority-minority map and the compactness map that follows borders). To draw the other four maps, we needed up-to-date vote data in the app. So we acquired precinct-level voting results for the 2012 and 2016 presidential elections from Decision Desk HQ, along with the boundaries of the precincts in those elections.

Those results weren’t quite complete enough for our purposes. We needed to account for absentee votes, which many states report only at the county level, not by precinct. In those states, we took all the absentee votes for a given candidate in a county and assigned them to precincts based on the precinct’s total share of in-person voters for that candidate. For example, if a precinct accounted for 5 percent of the Democratic candidate’s votes in a county, that precinct would be assigned 5 percent of the candidate’s absentee votes for the county.

Then, to get the more recent election data into the app, we converted it to the geographical building blocks that the app uses: 2010 precincts (specifically, voting districts provided to the Census Bureau by states) and block groups.

To do that, we first allocated the votes in each precinct to the precinct’s component census blocks. Each block was allocated a share of the precinct’s votes matching its share of the precinct’s voting-age population. Most blocks lie fully within a precinct, but in some cases, portions of a block fall in multiple precincts. In those cases, we split the block’s voting-age population based on the percentage of the block’s area that is in each precinct and allocated votes accordingly. Once we calculated the election results in each block, we combined the results using block-assignment files provided by the Census Bureau, which tell us which blocks are in which 2010 voting districts.

Then we provided the 2012 and 2016 results for each 2010 voting district to Bradlee, who added a way to see the Cook PVI of each custom-drawn district in his app.

Once the districts were drawn, we exported them from the app so that we could do our own analysis.

From political boundaries to election odds

The probabilities of electing a Democrat or Republican are based on how often seats with a given Cook PVI elected members of each party between 2006 and 2016. They reflect a seat’s expected performance over the long run, across a variety of political conditions. They are not predictions for the 2018 election, specifically.

We’ve also estimated the probability of a district electing a minority representative, based on the racial composition of each district and its Cook PVI. Districts with large numbers of nonwhite voters are much more likely to elect minorities, especially if they consist primarily of one ethnic or racial group (e.g., African-Americans) as opposed to a coalition of different racial groups. More Democratic-leaning districts are also slightly more likely to elect minorities, other factors being equal. This calculation is based on historical data between 2006 and 2016, although it includes an adjustment for the fact that minority representation has slightly increased over time.

Comparing the maps

One goal of this project was to see how the different types of maps compared on a few important factors — for example, would prioritizing compact districts mean losing majority-nonwhite districts, or would trying to stick to county borders and ignoring partisanship end up favoring one party over the other? We evaluated all the maps on a variety of metrics:

Expected seat split: We calculated the expected number of seats controlled by Democrats and Republicans, based on the parties’ likelihood of winning each district in the long term. A district that has a 60 percent chance of being represented by a Democrat and a 40 percent chance of being represented by a Republican, for example, counts as 0.6 of a Democratic representative and 0.4 of a Republican representative. To get the breakdown for a state, we totaled up the counts for each side.

Efficiency gap: This is one measure of how politically gerrymandered a legislative map is (and is currently the subject of a Supreme Court case). Using election results, the efficiency gap looks at the number of “wasted votes” for each party in each of the districts. Two types of votes are considered “wasted”: those cast for the losing candidate and those cast for the winning candidate in excess of what that candidate needed to win. The “gap,” expressed as a percentage, is the difference in each party’s wasted votes as a share of the total votes cast in the state. (See here for a more detailed, step-by-step guide to calculating the efficiency gap.) We don’t have real congressional election results for our hypothetical districts, so our efficiency-gap calculations use an average of the major-party vote in the past two presidential elections. In our atlas, we present the efficiency gap as a percentage in favor of either party (e.g., a value of R+7 percent means that there’s an efficiency gap of 7 percent that favors Republicans).

Competitive districts: We counted how many districts have a Cook PVI between D+5 and R+5.

Majority-nonwhite districts: We tallied the number of districts where nonwhite people make up a majority.

County splits: This counts how many times a district map splits counties into different districts. A common goal of redistricting is to preserve “communities of interest,” or groups of people who have common concerns (such as those who live in the same locality) and therefore have an interest in electing representatives together. We’ve used counties as a proxy for such communities. If a county contains all or part of two districts, it would be considered to have been split once (because the districts would share a common border).

Compactness rank: This is a way of evaluating the relative geographical compactness of districts in different maps. There are several methods for measuring the compactness of a geographic area, each of which has pros and cons. For our compactness rank, we focused on the perimeters of district boundaries because that allowed us to compare maps. We took the difference between the perimeter of the state and the sum of the perimeters of the districts’ boundaries and then divided by two (because each interior line is shared by two districts). In some cases, this approach can penalize relatively compact districts with jagged boundaries. But overall, it does a reasonable job of detecting which maps are more convoluted than necessary.