plot_household_head_ages_by_size#

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

Plot a comparison of the expected and generated age distribution of the household heads by the household size, presented as matrices. The age distribution of household heads is binned to match the expected data.

Parameters:
  • pop (sp.Pop) – population

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

  • **figdir (str) – directory to save the plot if provided

  • **title_prefix (str) – used to prefix the title of the plot

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

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

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

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

Returns:

Matplotlib figure and axes.

Example:

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

kwargs = pars.copy()
kwargs['cmap'] = 'rocket'
fig, ax = plot_household_head_ages_by_size(pop, **kwargs)