plot_school_sizes#

plot_school_sizes(pop, **kwargs)[source]#

Plot a comparison of the expected and generated school size distribution for each type of school expected.

Parameters:
  • pop (pop object) – population, either synthpops.pop.Pop, or dict

  • **with_school_types (type) – If True, plot school size distributions by type, else plot overall school size distributions

  • **keys_to_exclude (str or list) – school types to exclude

  • **left (float) – Matplotlib.figure.subplot.left

  • **right (float) – Matplotlib.figure.subplot.right

  • **top (float) – Matplotlib.figure.subplot.top

  • **bottom (float) – Matplotlib.figure.subplot.bottom

  • **hspace (float) – Matplotlib.figure.subplot.hspace

  • **subplot_height (float) – height of subplot in inches

  • **subplot_width (float) – width of subplot in inches

  • **screen_height_factor (float) – fraction of the screen height to use for display

  • **location_text_y (float) – height to add location text to figure

  • **fontsize (float) – Matplotlib.figure.fontsize

  • **rotation (float) – rotation angle for xticklabels

  • **cmap (str or Matplotlib cmap) – colormap

  • **figname (str) – name to save figure to disk

  • **comparison (bool) – If True, plot comparison to the generated population

  • **do_show (bool) – If True, show the plot

  • **do_save (bool) – If True, save the plot to disk

Returns:

Matplotlib figure and axes.

Note

If using pop with type sp.people.Pop or dict, args must be supplied for the location parameters to get the expected distribution.

Example:

pars = {'n': 10e3, 'location'='seattle_metro', 'state_location'='Washington', 'country_location'='usa'}
pop = sp.Pop(**pars)
fig, ax = pop.plot_school_sizes_by_type()

popdict = pop.to_dict()
kwargs = pars.copy()
kwargs['datadir'] = sp.datadir
fig, ax = sp.plot_school_sizes(popdict, **kwargs)