Plots a boxplot of a quantity of interest across districts, with districts optionally sorted by this quantity. Adds reference points for each reference plan, if applicable.

redist.plot.distr_qtys(
  plans,
  qty,
  sort = "asc",
  geom = "jitter",
  color_thresh = NULL,
  ...
)

Arguments

plans

the redist_plans object.

qty

<data-masking> the quantity of interest.

sort

set to "asc" to sort districts in ascending order of qty (the default), "desc" for descending order, or FALSE or "none" for no sorting.

geom

the geom to use in plotting the simulated districts: either "jitter" or "boxplot"

color_thresh

if a number, the threshold to use in coloring the points. Plans with quantities of interest above the threshold will be colored differently than plans below the threshold.

...

passed on to geom_boxplot

Value

A ggplot

Examples

library(dplyr) data(iowa) iowa = redist_map(iowa, existing_plan=cd_2010, pop_tol=0.05, total_pop = pop) plans = redist_smc(iowa, nsims=100, silent=TRUE) plans %>% mutate(pct_dem = group_frac(iowa, dem_08, tot_08)) %>% redist.plot.distr_qtys(pct_dem)