The statehouse districts in Iowa were drawn in 2011. There are 50 senate districts, 25 of which are elected in each election cycle, and 100 house districts. For the senate districts, while the elections in 2012 and 2014 favored the Democrats, in 2016, 2018, and 2020 the Republicans were favored.

In the house, in 2018, Democrats received more votes but Republucans won more senate seats. In 2012, 2014, 2016, and 2020, the Republicans won both the votes and the statehouse.

The reason for the imbalance in 2018 is that Democratic districts are almost always urban and Republican districts are almost always rural, while the urban districts have a higher proportion of Democrats than the rural districts have of Republicans. The code and data can be found at http://rpubs.com/margothtc/732593.