Output Plotting Functions#

output_plots.py modules

ogcore.output_plots#

ogcore.output_plots.ability_bar(base_tpi, base_params, reform_tpi, reform_params, var='n_mat', num_years=5, start_year=2021, plot_title=None, path=None)[source]#

Plots percentage changes from baseline by ability group for a given variable.

Parameters:
  • base_tpi (dictionary) – TPI output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_tpi (dictionary) – TPI output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • var (string) – name of variable to plot

  • num_year (integer) – number of years to compute changes over

  • start_year (integer) – year to start plot

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of results by ability type

Return type:

fig (Matplotlib plot object)

ogcore.output_plots.ability_bar_ss(base_ss, base_params, reform_ss, reform_params, var='nssmat', plot_title=None, path=None)[source]#

Plots percentage changes from baseline by ability group for a given variable.

Parameters:
  • base_ss (dictionary) – SS output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_ss (dictionary) – SS output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • var (string) – name of variable to plot

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of results by ability type

Return type:

fig (Matplotlib plot object)

ogcore.output_plots.plot_aggregates(base_tpi, base_params, reform_tpi=None, reform_params=None, var_list=['Y', 'C', 'K', 'L'], plot_type='pct_diff', stationarized=True, num_years_to_plot=50, start_year=2021, forecast_data=None, forecast_units=None, vertical_line_years=None, plot_title=None, path=None)[source]#

Create a plot of macro aggregates.

Parameters:
  • base_tpi (dictionary) – TPI output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_tpi (dictionary) – TPI output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • var_list (list) – names of variable to plot

  • plot_type (string) –

    type of plot, can be: ‘pct_diff’: plots percentage difference between baseline

    and reform ((reform-base)/base)

    ’diff’: plots difference between baseline and reform

    (reform-base)

    ’levels’: plot variables in model units ‘forecast’: plots variables in levels relative to baseline

    economic forecast

  • stationarized (bool) – whether used stationarized variables (False only affects pct_diff right now)

  • num_years_to_plot (integer) – number of years to include in plot

  • start_year (integer) – year to start plot

  • forecast_data (array_like) – baseline economic forecast series, must have length = num_year_to_plot

  • forecast_units (str) – units that baseline economic forecast is in

  • vertical_line_years (list) – list of integers for years want vertical lines at

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of macro aggregates

Return type:

fig (Matplotlib plot object)

ogcore.output_plots.plot_all(base_output_path, reform_output_path, save_path)[source]#

Function to plot all default output plots.

Parameters:
  • base_output_path (str) – path to baseline results

  • reform_output_path (str) – path to reform results

  • save_path (str) – path to save plots to

Returns:

All output figures saved to disk.

Return type:

None

ogcore.output_plots.plot_gdp_ratio(base_tpi, base_params, reform_tpi=None, reform_params=None, var_list=['D'], plot_type='levels', num_years_to_plot=50, start_year=2021, vertical_line_years=None, plot_title=None, path=None)[source]#

Create a plot of some variable to GDP.

Parameters:
  • base_tpi (dictionary) – TPI output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_tpi (dictionary) – TPI output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • p (OG-Core Specifications class) – parameters object

  • var_list (list) – names of variable to plot

  • plot_type (string) –

    type of plot, can be: ‘diff’: plots difference between baseline and reform

    (reform-base)

    ’levels’: plot variables in model units

  • num_years_to_plot (integer) – number of years to include in plot

  • start_year (integer) – year to start plot

  • vertical_line_years (list) – list of integers for years want vertical lines at

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of ratio of a variable to GDP

Return type:

fig (Matplotlib plot object)

ogcore.output_plots.ss_profiles(base_ss, base_params, reform_ss=None, reform_params=None, by_j=True, var='nssmat', plot_data=None, plot_title=None, path=None)[source]#

Plot lifecycle profiles of given variable in the SS.

Parameters:
  • base_ss (dictionary) – SS output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_ss (dictionary) – SS output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • var (string) – name of variable to plot

  • plot_data (array_like) – series of data to add to plot

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of lifecycle profiles

Return type:

fig (Matplotlib plot object)

ogcore.output_plots.tpi_profiles(base_tpi, base_params, reform_tpi=None, reform_params=None, by_j=True, var='n_mat', num_years=5, start_year=2021, plot_title=None, path=None)[source]#

Plot lifecycle profiles of given variable in the SS.

Parameters:
  • base_ss (dictionary) – TPI output from baseline run

  • base_params (OG-Core Specifications class) – baseline parameters object

  • reform_ss (dictionary) – TPI output from reform run

  • reform_params (OG-Core Specifications class) – reform parameters object

  • var (string) – name of variable to plot

  • num_year (integer) – number of years to compute changes over

  • start_year (integer) – year to start plot

  • plot_title (string) – title for plot

  • path (string) – path to save figure to

Returns:

plot of lifecycle profiles

Return type:

fig (Matplotlib plot object)