From 3ae6d1290d4ecf139d3673e15b609b5056a513ea Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Tue, 9 Sep 2025 13:49:40 +0100 Subject: [PATCH 1/4] Add HBAI poverty notebook --- docs/book/validation/hbai-poverty-rates.ipynb | 6039 +++++++++++++++++ docs/book/validation/hbai.md | 2 +- myst.yml | 1 + 3 files changed, 6041 insertions(+), 1 deletion(-) create mode 100644 docs/book/validation/hbai-poverty-rates.ipynb diff --git a/docs/book/validation/hbai-poverty-rates.ipynb b/docs/book/validation/hbai-poverty-rates.ipynb new file mode 100644 index 000000000..335707428 --- /dev/null +++ b/docs/book/validation/hbai-poverty-rates.ipynb @@ -0,0 +1,6039 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# HBAI poverty rates\n", + "\n", + "This notebook compares official HBAI poverty statistics with PolicyEngine model outputs. We examine four poverty definitions:\n", + "- Absolute poverty before housing costs (BHC)\n", + "- Absolute poverty after housing costs (AHC)\n", + "- Relative poverty before housing costs (BHC)\n", + "- Relative poverty after housing costs (AHC)\n", + "\n", + "Official data covers 2002-2023, while model projections cover 2023-2030." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Generate all data" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "tags": [ + "hide-input" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from IPython.core.display import HTML, display_html\n", + "\n", + "\n", + "def add_fonts():\n", + " fonts = HTML(\n", + " \"\"\"\n", + " \n", + " \n", + " \n", + " \"\"\"\n", + " )\n", + " return display_html(fonts)\n", + "\n", + "add_fonts()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "tags": [ + "hide-input" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " \n", + " \n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Official data: 2002-2023\n", + "Age groups: ['All' 'Children' 'Pensioners' 'Working age']\n" + ] + } + ], + "source": [ + "from policyengine_uk import Microsimulation\n", + "import pandas as pd\n", + "import numpy as np\n", + "import plotly.express as px\n", + "import plotly.graph_objects as go\n", + "from policyengine_core.charts import format_fig, BLUE_COLOUR_SCALE, GRAY\n", + "\n", + "# Load official HBAI poverty outturn data\n", + "official_data = pd.read_csv('hbai_outturn.csv')\n", + "official_data = official_data[official_data['scenario'] == 'Baseline'].copy()\n", + "\n", + "print(f\"Official data: {official_data['year'].min()}-{official_data['year'].max()}\")\n", + "print(f\"Age groups: {official_data['group'].unique()}\")\n", + "\n", + "def get_age_group(age):\n", + " \"\"\"Map age to HBAI age groups.\"\"\"\n", + " if age < 18:\n", + " return \"Children\"\n", + " elif age < 66:\n", + " return \"Working age\"\n", + " else:\n", + " return \"Pensioners\"\n", + "\n", + "def calculate_poverty_stats_hbai_format(dataset=\"enhanced_frs\", scenario=\"PolicyEngine EFRS\"):\n", + " \"\"\"Calculate poverty stats in the same format as official HBAI data.\"\"\"\n", + " \n", + " sim = Microsimulation(dataset=f\"hf://policyengine/policyengine-uk-data-private/{dataset}_2023_24.h5\")\n", + " results = []\n", + " \n", + " # Map our variable names to HBAI format\n", + " poverty_map = {\n", + " (\"in_poverty_bhc\", True, False): (True, False), # BHC, absolute\n", + " (\"in_poverty_ahc\", False, False): (False, False), # AHC, absolute\n", + " (\"in_relative_poverty_bhc\", True, True): (True, True), # BHC, relative\n", + " (\"in_relative_poverty_ahc\", False, True): (False, True), # AHC, relative\n", + " }\n", + " \n", + " for year in range(2023, 2031):\n", + " # Get data for this year\n", + " df = sim.calculate_dataframe(\n", + " [\"age\", \"in_poverty_bhc\", \"in_poverty_ahc\", \n", + " \"in_relative_poverty_bhc\", \"in_relative_poverty_ahc\", \"person_weight\"],\n", + " period=year\n", + " )\n", + " \n", + " # Add age groups\n", + " df[\"age_group\"] = df[\"age\"].apply(get_age_group)\n", + " \n", + " # Calculate for each poverty type and age group\n", + " for pov_var, (bhc, relative) in poverty_map.items():\n", + " for group in [\"All\", \"Children\", \"Working age\", \"Pensioners\"]:\n", + " if group == \"All\":\n", + " group_df = df\n", + " else:\n", + " group_df = df[df[\"age_group\"] == group]\n", + " \n", + " total_pop = group_df[\"person_weight\"].sum()\n", + " poor_pop = group_df[group_df[pov_var[0]] == 1][\"person_weight\"].sum()\n", + " \n", + " if total_pop > 0:\n", + " poverty_rate = poor_pop / total_pop\n", + " else:\n", + " poverty_rate = 0\n", + " \n", + " # Add poverty rate row\n", + " results.append({\n", + " \"scenario\": scenario,\n", + " \"year\": year,\n", + " \"bhc\": bhc,\n", + " \"relative\": relative,\n", + " \"headcount\": False,\n", + " \"group\": group,\n", + " \"poverty_rate\": poverty_rate\n", + " })\n", + " \n", + " # Add headcount row\n", + " results.append({\n", + " \"scenario\": scenario,\n", + " \"year\": year,\n", + " \"bhc\": bhc,\n", + " \"relative\": relative,\n", + " \"headcount\": True,\n", + " \"group\": group,\n", + " \"poverty_rate\": poor_pop\n", + " })\n", + " \n", + " return pd.DataFrame(results)\n", + "\n", + "# Calculate model results for both datasets\n", + "frs_model = calculate_poverty_stats_hbai_format(\"frs\", \"PE FRS\")\n", + "\n", + "efrs_model = calculate_poverty_stats_hbai_format(\"enhanced_frs\", \"PE EFRS\")\n", + "\n", + "# Combine all data\n", + "model_data = pd.concat([frs_model, efrs_model], ignore_index=True)\n", + "all_data = pd.concat([official_data, model_data], ignore_index=True)\n", + "\n", + "# Helper functions for visualisation\n", + "def get_poverty_description(bhc, relative):\n", + " \"\"\"Get human-readable poverty type description.\"\"\"\n", + " housing = \"BHC\" if bhc else \"AHC\"\n", + " pov_type = \"Relative\" if relative else \"Absolute\"\n", + " return f\"{pov_type} poverty {housing}\"\n", + "\n", + "def show_poverty_analysis(data, bhc, relative):\n", + " \"\"\"Show table and faceted chart for a specific poverty type.\"\"\"\n", + " \n", + " poverty_desc = get_poverty_description(bhc, relative)\n", + " \n", + " # Filter for specific poverty type (rates only, not headcounts)\n", + " subset = data[\n", + " (data['bhc'] == bhc) & \n", + " (data['relative'] == relative) & \n", + " (data['headcount'] == False)\n", + " ].copy()\n", + " \n", + " # Convert to percentages\n", + " subset['poverty_rate'] = subset['poverty_rate'] * 100\n", + " \n", + " # Show comparison table for 2023\n", + " comparison_2023 = subset[subset['year'] == 2023].pivot_table(\n", + " index='group',\n", + " columns='scenario',\n", + " values='poverty_rate'\n", + " ).round(1)\n", + " \n", + " # Create faceted line chart\n", + " fig = px.line(\n", + " subset[subset['group'] != 'All'],\n", + " x='year',\n", + " y='poverty_rate',\n", + " color='scenario',\n", + " facet_col='group',\n", + " title=poverty_desc,\n", + " labels={'poverty_rate': 'Poverty rate (%)', 'year': 'Year'},\n", + " markers=True,\n", + " color_discrete_map={\n", + " 'Baseline': GRAY,\n", + " 'PolicyEngine FRS': BLUE_COLOUR_SCALE[1],\n", + " 'PolicyEngine EFRS': BLUE_COLOUR_SCALE[2]\n", + " },\n", + " height=400\n", + " )\n", + " \n", + " # Add vertical line at 2023\n", + " fig.add_vline(x=2023, line_dash=\"dot\", line_color=\"gray\", opacity=0.5)\n", + " \n", + " fig = format_fig(fig)\n", + " fig.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Absolute poverty before housing costs (BHC)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x", + "y": [ + 26.01973149456896, + 25.014002154989463, + 23.39815918214234, + 23.74504037575366, + 22.8142961088124, + 22.26258687739866, + 21.23375364142685, + 18.89313385191949, + 17.54338533423644, + 19.24017175344204, + 18.423480098266808, + 17.59107771771793, + 17.31670323001963, + 17.090302047940963, + 15.821739604991999, + 17.939207239589237, + 17.20055733225762, + 17.411703068160918, + 15.93013685327306, + 15.53108212041458, + 18.20874080448775, + 19.987254015557422 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x2", + "y": [ + 28.75617474982084, + 26.00094307371522, + 23.31361020934119, + 21.65898651650038, + 23.299494080423617, + 21.98525848510523, + 19.22956644140566, + 16.745079065115608, + 17.04110907837674, + 17.15743833010278, + 16.58046855853538, + 16.75884554540138, + 14.796925606952, + 15.370981419814619, + 14.550833779354061, + 15.40528484838713, + 15.27324152242918, + 14.78833202491999, + 13.08585735821938, + 14.36828096302756, + 14.787122226711949, + 15.956044131040839 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x3", + "y": [ + 16.4601694617816, + 16.23409540325147, + 15.444501271986349, + 15.93449323654571, + 15.09970174072253, + 15.393158527238349, + 15.50485180598406, + 15.124253153994019, + 15.03196081019322, + 16.03958651920987, + 15.29198335036753, + 14.59367618867488, + 13.95688648391934, + 13.40140499075551, + 12.81181033587375, + 13.260725555868419, + 13.768887445753581, + 12.62916244471305, + 12.41188505681452, + 12.42438959196492, + 12.48612461565693, + 12.93856619294316 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 24.592780940236914, + 23.38658703366243, + 24.041701520824034, + 23.594522645467798, + 23.883570209248518, + 23.8212451852669, + 23.427588000211617, + 23.795165648238626 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 21.560285275969136, + 21.015295808959838, + 19.510728043185225, + 19.230306534380574, + 18.93767037629477, + 17.36825207818007, + 17.19546938563428, + 17.138146294201743 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 15.69406249188556, + 15.038223761517067, + 15.205038353990222, + 15.107513107120674, + 15.211234377999636, + 15.173615544284056, + 14.974797630920033, + 15.102988078014423 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 15.757297001755704, + 14.590242291833485, + 14.876097154966802, + 14.671447030770453, + 14.844230221472158, + 15.23256166802609, + 15.043045616282724, + 15.575471347004596 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 4.341386768080949, + 4.3008456805255575, + 4.217946923032171, + 4.2071318166309695, + 4.204656844656682, + 4.203407652344449, + 4.203378541877439, + 4.202252082548097 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 12.14003552129247, + 10.956208351398923, + 12.628971244399706, + 12.612523712867374, + 12.684091857645532, + 12.754273780909916, + 12.675615958100131, + 12.81717927024307 + ], + "yaxis": "y3" + } + ], + "layout": { + "annotations": [ + { + "showarrow": false, + "text": "group=Children", + "x": 0.15999999999999998, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Pensioners", + "x": 0.49999999999999994, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Working age", + "x": 0.8399999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "scenario" + }, + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "shapes": [ + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + } + ], + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Absolute poverty BHC" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.31999999999999995 + ], + "title": { + "text": "Year" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.33999999999999997, + 0.6599999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.6799999999999999, + 0.9999999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + }, + "yaxis3": { + "anchor": "x3", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_poverty_analysis(all_data, bhc=True, relative=False)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Absolute poverty after housing costs (AHC)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x", + "y": [ + 31.42606824507868, + 29.89978041951682, + 29.363075348510442, + 30.290050770337018, + 30.55088753592844, + 30.82778868175308, + 29.861844220796428, + 28.23701180081523, + 27.16993505859437, + 28.25245703342324, + 28.83689892807656, + 28.273692800925698, + 27.144793248165012, + 26.758656007618598, + 25.43100895578591, + 26.318619078029943, + 26.0421253207687, + 24.8288137713004, + 22.8586049143593, + 22.83658849140579, + 25.025731203374928, + 26.39365338256261 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x2", + "y": [ + 28.822209854620677, + 23.63324016329598, + 19.02273133860248, + 17.5891566768228, + 18.69745290285137, + 17.00554251271059, + 15.290357968034249, + 14.388442002108029, + 14.04808949180607, + 14.407972570186681, + 14.18084623013662, + 14.450626558942409, + 12.82838891018696, + 13.58506989670524, + 12.945075525573522, + 13.59191097993515, + 13.48304646549334, + 12.762443096939, + 10.75125904126698, + 12.36603291450977, + 11.76197123902476, + 13.15809619673794 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x3", + "y": [ + 20.473205194849207, + 20.08942993636053, + 19.34687805605131, + 20.583770028155097, + 20.32114452791699, + 20.41077191353387, + 21.083333108810688, + 21.05563514139544, + 21.151118526137548, + 21.70565696905753, + 22.18201188954441, + 21.359065436971008, + 20.01674654972456, + 19.417276230870183, + 18.9771830789171, + 18.38564549535181, + 19.12278686398421, + 16.918771339408607, + 16.40669210204824, + 16.48117646471723, + 17.05871694245511, + 16.853738387852278 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 32.37867467281448, + 31.081989743908554, + 34.16938471422612, + 33.99239108855113, + 34.45032196966801, + 34.25543924239135, + 34.17221691393201, + 34.41296285264998 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 17.911071894499038, + 15.583933162260399, + 16.08875203641195, + 15.735072931681227, + 15.608782203396565, + 15.470181530723293, + 15.425411736471432, + 15.660361558215161 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 20.294296587662636, + 19.734392709897282, + 20.29129280433275, + 20.302918474749408, + 20.411299681180665, + 20.30061673376119, + 20.289191079088116, + 20.350028901363675 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 27.475809562225777, + 26.89978385024922, + 30.20233038593852, + 30.09300343231252, + 30.12619818104022, + 30.096755563335805, + 31.3525028938604, + 31.82614906555916 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 1.0470712686260795, + 0.9509949638601656, + 0.9587312964642116, + 0.9323112576486634, + 0.9315859020864128, + 0.9305526109211485, + 0.9565434173646432, + 0.9539840160826032 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 31.649526380215526, + 31.149550909804507, + 31.6697501661796, + 31.532515454257076, + 31.53879229933682, + 31.531165420787215, + 32.2598587942082, + 32.129997180632074 + ], + "yaxis": "y3" + } + ], + "layout": { + "annotations": [ + { + "showarrow": false, + "text": "group=Children", + "x": 0.15999999999999998, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Pensioners", + "x": 0.49999999999999994, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Working age", + "x": 0.8399999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "scenario" + }, + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "shapes": [ + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + } + ], + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Absolute poverty AHC" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.31999999999999995 + ], + "title": { + "text": "Year" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.33999999999999997, + 0.6599999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.6799999999999999, + 0.9999999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + }, + "yaxis3": { + "anchor": "x3", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_poverty_analysis(all_data, bhc=False, relative=False)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Relative poverty before housing costs (BHC)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x", + "y": [ + 22.1151131564807, + 21.718549002731518, + 21.0389782169164, + 21.72072229816987, + 22.28212257932733, + 22.35871988414835, + 22.02582388569701, + 19.88519490659034, + 17.54338533423644, + 17.5506579502783, + 17.30634250941955, + 17.03643407861188, + 18.5389903418229, + 19.71359382214444, + 19.40314623415787, + 21.68664790631358, + 19.93117487523058, + 22.85118898089553, + 19.48792035694186, + 20.016380635081397, + 22.32477330226203, + 23.18849341106766 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x2", + "y": [ + 23.80551693197907, + 22.741299228178562, + 20.75850535161042, + 20.19440411939901, + 22.70015336621508, + 22.08307757585854, + 19.83424503681051, + 17.69499839065502, + 17.04110907837674, + 15.95708537244421, + 15.693498971428879, + 16.20286568146337, + 16.41638142163998, + 17.24278781889952, + 17.60995208896991, + 18.35857457321487, + 17.81656140411422, + 19.21518454226275, + 16.37109320713685, + 17.93192910459821, + 18.317054885325028, + 18.642029691469382 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x3", + "y": [ + 14.34455671573913, + 14.48979884859363, + 14.156110152299888, + 15.00950268927327, + 14.82589108753976, + 15.43134825277502, + 15.88122506664611, + 15.64817232682692, + 15.03196081019322, + 15.02756774365141, + 14.651876801557782, + 14.261994666159461, + 14.721342880285402, + 14.914962361089781, + 14.70844386644636, + 15.132813898761018, + 15.290725042438922, + 15.75208280617428, + 14.39307957079112, + 14.948119292544309, + 14.7650673952168, + 14.68902336218644 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 27.152917482942062, + 26.89965072138926, + 27.344585005796198, + 28.08062058278653, + 28.126367162521902, + 28.427328342833075, + 28.631744007481963, + 28.83322431556572 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 22.626773888557768, + 23.404700120771505, + 22.929393503371777, + 22.504993300740097, + 21.975432342207327, + 22.129577278355335, + 22.158160677394694, + 21.29317872299489 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 16.824489159308285, + 16.79843277711673, + 17.012595039113165, + 17.26549745653385, + 17.30789674188529, + 17.437348656301502, + 17.47069594333526, + 17.489906812646378 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 19.02718051399632, + 19.124112534152843, + 19.154039236122518, + 19.114828585086713, + 19.11331167857437, + 19.11642440146099, + 19.020939673455338, + 20.401170383647894 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 4.450450759444146, + 4.56908022933716, + 4.460887103730734, + 4.453385961515692, + 4.452023186826072, + 4.450501810745137, + 4.448927991586455, + 4.448681798625182 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 14.280093082740947, + 19.866777959980247, + 19.869115546163503, + 19.843272714389297, + 19.843158872630365, + 20.08917868816643, + 20.058580242567437, + 20.539113893347764 + ], + "yaxis": "y3" + } + ], + "layout": { + "annotations": [ + { + "showarrow": false, + "text": "group=Children", + "x": 0.15999999999999998, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Pensioners", + "x": 0.49999999999999994, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Working age", + "x": 0.8399999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "scenario" + }, + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "shapes": [ + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + } + ], + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Relative poverty BHC" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.31999999999999995 + ], + "title": { + "text": "Year" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.33999999999999997, + 0.6599999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.6799999999999999, + 0.9999999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + }, + "yaxis3": { + "anchor": "x3", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_poverty_analysis(all_data, bhc=True, relative=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Relative poverty after housing costs (AHC)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x", + "y": [ + 29.207015801079876, + 28.363787858777577, + 28.06078639158996, + 29.33954380719472, + 30.69507590358108, + 31.296829186854218, + 30.35808906971854, + 29.37677451663308, + 27.16993505859437, + 26.97839929439812, + 27.21172973923196, + 27.48179133696324, + 28.51711899741745, + 29.418094589573514, + 30.04782241367358, + 29.31592820056681, + 29.399670105323324, + 30.683408236304686, + 27.11902744929466, + 29.17325370014392, + 29.9144181073631, + 30.51705063293655 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x2", + "y": [ + 23.871294422585933, + 20.39193228696699, + 17.251364756095462, + 16.391468102150817, + 18.822295680010683, + 17.74366060675332, + 15.677646640250911, + 15.249001239126562, + 14.04808949180607, + 13.41297121101643, + 13.254338936294749, + 13.74500330111735, + 13.83408502839221, + 15.705307884864519, + 15.862941626372901, + 16.54535185494016, + 15.9293043688548, + 18.1373648828177, + 14.651090243768289, + 17.58389395232769, + 15.85668028450148, + 15.664066099520019 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x3", + "y": [ + 19.00294643203232, + 19.04135921606549, + 18.61808609185504, + 20.07343360985456, + 20.4127502056737, + 20.721843176210182, + 21.335844101301753, + 21.73118432238978, + 21.151118526137548, + 21.13089737192626, + 21.22131562562026, + 20.93584608340996, + 20.80303688186323, + 20.9500921843136, + 21.14387693589195, + 20.39205574979795, + 21.09535611176609, + 20.14805684442084, + 19.57652070537544, + 20.17082956273881, + 19.9877072319224, + 19.34954598744519 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 38.074027115607194, + 38.132976278030114, + 38.7929603099011, + 39.08794105223388, + 39.344429146822264, + 39.716865268350844, + 39.70857402020221, + 40.05994977935245 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 21.67594788656187, + 21.79878403709025, + 20.630795697803833, + 20.284633279804073, + 19.900056356489802, + 19.83787026186378, + 19.51659014255231, + 19.903722914243325 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#ab63fa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 22.27508934587312, + 22.41596292067644, + 22.772448250609866, + 22.953907682555133, + 23.02354309414439, + 23.20391825714952, + 23.143666557831803, + 23.190213189203355 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x", + "y": [ + 33.22568241790446, + 33.21473474231569, + 36.072618355666776, + 36.07533386150587, + 36.17358685847445, + 36.162613873521686, + 36.17348568555037, + 37.00268393208157 + ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 4.289363566365633, + 4.3004837184269205, + 4.285412803968219, + 4.277988540768014, + 4.275074553933701, + 4.273565132863523, + 4.2714045176426225, + 4.275409971626422 + ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#FFA15A", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 36.433063103612724, + 36.6147682281975, + 38.718867852550844, + 38.73470137317763, + 38.753869243999645, + 38.75422381006287, + 38.75631001431661, + 38.85676586978203 + ], + "yaxis": "y3" + } + ], + "layout": { + "annotations": [ + { + "showarrow": false, + "text": "group=Children", + "x": 0.15999999999999998, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Pensioners", + "x": 0.49999999999999994, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Working age", + "x": 0.8399999999999999, + "xanchor": "center", + "xref": "paper", + "y": 1, + "yanchor": "bottom", + "yref": "paper" + } + ], + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.15, + "sizey": 0.15, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1.1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "scenario" + }, + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "shapes": [ + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x", + "y0": 0, + "y1": 1, + "yref": "y domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x2", + "y0": 0, + "y1": 1, + "yref": "y2 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x3", + "y0": 0, + "y1": 1, + "yref": "y3 domain" + } + ], + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Relative poverty AHC" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 0.31999999999999995 + ], + "title": { + "text": "Year" + } + }, + "xaxis2": { + "anchor": "y2", + "domain": [ + 0.33999999999999997, + 0.6599999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "xaxis3": { + "anchor": "y3", + "domain": [ + 0.6799999999999999, + 0.9999999999999999 + ], + "matches": "x", + "title": { + "text": "Year" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis2": { + "anchor": "x2", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + }, + "yaxis3": { + "anchor": "x3", + "domain": [ + 0, + 1 + ], + "matches": "y", + "showticklabels": false + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "show_poverty_analysis(all_data, bhc=False, relative=True)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/docs/book/validation/hbai.md b/docs/book/validation/hbai.md index 5c7d81cba..2e8c2c46b 100644 --- a/docs/book/validation/hbai.md +++ b/docs/book/validation/hbai.md @@ -1,4 +1,4 @@ -# HBAI +# HBAI components ```{note} PolicyEngine UK includes variables that match to the Households Below Average Income (HBAI) income concepts. diff --git a/myst.yml b/myst.yml index b4a11aab8..48b55db46 100644 --- a/myst.yml +++ b/myst.yml @@ -24,6 +24,7 @@ project: - title: Validation children: - file: docs/book/validation/hbai + - file: docs/book/validation/hbai-poverty-rates - title: Policy children: - file: docs/book/policy/model-baseline From e6905c880aba8a04dd52cc58a0ed67cf5101219d Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Wed, 10 Sep 2025 10:51:36 +0100 Subject: [PATCH 2/4] Update poverty rates --- docs/book/validation/hbai-poverty-rates.ipynb | 1259 +++++++++++++---- 1 file changed, 999 insertions(+), 260 deletions(-) diff --git a/docs/book/validation/hbai-poverty-rates.ipynb b/docs/book/validation/hbai-poverty-rates.ipynb index 335707428..18601f551 100644 --- a/docs/book/validation/hbai-poverty-rates.ipynb +++ b/docs/book/validation/hbai-poverty-rates.ipynb @@ -221,22 +221,25 @@ " values='poverty_rate'\n", " ).round(1)\n", " \n", - " # Create faceted line chart\n", + " # Create faceted line chart including 'All' group\n", " fig = px.line(\n", - " subset[subset['group'] != 'All'],\n", + " subset,\n", " x='year',\n", " y='poverty_rate',\n", " color='scenario',\n", " facet_col='group',\n", + " facet_col_wrap=2, # Wrap after 2 columns for better layout\n", " title=poverty_desc,\n", " labels={'poverty_rate': 'Poverty rate (%)', 'year': 'Year'},\n", " markers=True,\n", " color_discrete_map={\n", " 'Baseline': GRAY,\n", " 'PolicyEngine FRS': BLUE_COLOUR_SCALE[1],\n", - " 'PolicyEngine EFRS': BLUE_COLOUR_SCALE[2]\n", + " 'PolicyEngine EFRS': BLUE_COLOUR_SCALE[2],\n", + " 'PE FRS': BLUE_COLOUR_SCALE[1],\n", + " 'PE EFRS': BLUE_COLOUR_SCALE[2]\n", " },\n", - " height=400\n", + " height=600 # Increased height to accommodate 4 panels\n", " )\n", " \n", " # Add vertical line at 2023\n", @@ -266,7 +269,7 @@ }, "data": [ { - "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "hovertemplate": "scenario=Baseline
group=All
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "Baseline", "line": { "color": "#808080", @@ -304,7 +307,73 @@ 2022, 2023 ], - "xaxis": "x", + "xaxis": "x3", + "y": [ + 20.78442062756483, + 19.930296741242458, + 18.61734674830547, + 18.67496946834252, + 18.27007213878192, + 18.09506030656126, + 17.426364617485, + 16.24382278042705, + 15.9533865856187, + 16.93011848525374, + 16.201242338935078, + 15.640903716497279, + 14.83035784406354, + 14.553866027220971, + 13.77291006355442, + 14.64970018307416, + 14.771031924002608, + 14.02816367793697, + 13.291448423826141, + 13.44306876204934, + 14.131878921154769, + 15.00070387453306 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x4", "y": [ 26.01973149456896, 25.014002154989463, @@ -329,7 +398,7 @@ 18.20874080448775, 19.987254015557422 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", @@ -370,7 +439,7 @@ 2022, 2023 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 28.75617474982084, 26.00094307371522, @@ -395,7 +464,7 @@ 14.787122226711949, 15.956044131040839 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", @@ -436,7 +505,7 @@ 2022, 2023 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 16.4601694617816, 16.23409540325147, @@ -461,13 +530,51 @@ 12.48612461565693, 12.93856619294316 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#2C6496", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 18.30905249431316, + 17.54791918326429, + 17.62073716102601, + 17.425340678576895, + 17.521914299717398, + 17.298461454550512, + 17.060792993945284, + 17.2170542408597 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -476,7 +583,7 @@ "mode": "lines+markers", "name": "PE FRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -488,24 +595,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 24.592780940236914, 23.38658703366243, 24.041701520824034, 23.594522645467798, 23.883570209248518, - 23.8212451852669, - 23.427588000211617, + 23.82311090586527, + 23.42945372082338, 23.795165648238626 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -526,7 +633,7 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 21.560285275969136, 21.015295808959838, @@ -537,13 +644,13 @@ 17.19546938563428, 17.138146294201743 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -564,24 +671,62 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 15.69406249188556, 15.038223761517067, 15.205038353990222, - 15.107513107120674, - 15.211234377999636, - 15.173615544284056, - 14.974797630920033, + 15.106321359047708, + 15.210301230244733, + 15.175071510656874, + 14.976253597563874, 15.102988078014423 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#17354F", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 10.404063481571542, + 9.533449346252059, + 10.579135981946598, + 10.543931455880031, + 10.606253295393781, + 10.691442301381153, + 10.622302704853324, + 10.766669624063985 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -590,7 +735,7 @@ "mode": "lines+markers", "name": "PE EFRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -602,24 +747,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 15.757297001755704, 14.590242291833485, 14.876097154966802, - 14.671447030770453, - 14.844230221472158, - 15.23256166802609, - 15.043045616282724, + 14.671447374688373, + 14.844230565390076, + 15.233270455808295, + 15.043753837189936, 15.575471347004596 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -640,7 +785,7 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 4.341386768080949, 4.3008456805255575, @@ -651,13 +796,13 @@ 4.203378541877439, 4.202252082548097 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -678,49 +823,59 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 12.14003552129247, 10.956208351398923, 12.628971244399706, - 12.612523712867374, - 12.684091857645532, - 12.754273780909916, - 12.675615958100131, + 12.612377510131745, + 12.68403924644903, + 12.754607238513277, + 12.675949294200532, 12.81717927024307 ], - "yaxis": "y3" + "yaxis": "y2" } ], "layout": { "annotations": [ { "showarrow": false, - "text": "group=Children", - "x": 0.15999999999999998, + "text": "group=Pensioners", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Pensioners", - "x": 0.49999999999999994, + "text": "group=Working age", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Working age", - "x": 0.8399999999999999, + "text": "group=All", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.9999999999999999, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Children", + "x": 0.755, + "xanchor": "center", + "xref": "paper", + "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" } @@ -795,6 +950,20 @@ "y0": 0, "y1": 1, "yref": "y3 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" } ], "template": { @@ -1621,7 +1790,7 @@ "anchor": "y", "domain": [ 0, - 0.31999999999999995 + 0.49 ], "title": { "text": "Year" @@ -1630,8 +1799,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.33999999999999997, - 0.6599999999999999 + 0.51, + 1 ], "matches": "x", "title": { @@ -1641,19 +1810,26 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.6799999999999999, - 0.9999999999999999 + 0, + 0.49 ], "matches": "x", - "title": { - "text": "Year" - } + "showticklabels": false + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, - 1 + 0.46499999999999997 ], "title": { "text": "Poverty rate (%)" @@ -1663,7 +1839,7 @@ "anchor": "x2", "domain": [ 0, - 1 + 0.46499999999999997 ], "matches": "y", "showticklabels": false @@ -1671,8 +1847,19 @@ "yaxis3": { "anchor": "x3", "domain": [ - 0, - 1 + 0.5349999999999999, + 0.9999999999999999 + ], + "matches": "y", + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.5349999999999999, + 0.9999999999999999 ], "matches": "y", "showticklabels": false @@ -1708,7 +1895,7 @@ }, "data": [ { - "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "hovertemplate": "scenario=Baseline
group=All
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "Baseline", "line": { "color": "#808080", @@ -1746,7 +1933,73 @@ 2022, 2023 ], - "xaxis": "x", + "xaxis": "x3", + "y": [ + 24.39606060850854, + 22.88820596105, + 21.48480230838232, + 22.14941014548584, + 22.24404500304989, + 22.03142947343488, + 21.88043977632409, + 21.3414657973655, + 21.0934490241877, + 21.729292650565853, + 22.09086162726826, + 21.51760407414711, + 20.17451026169086, + 19.88162736796042, + 19.22587230935303, + 19.193353061343778, + 19.58056748308786, + 17.86527791631363, + 16.81612338780378, + 17.1441463974895, + 17.84559545646473, + 18.255371131474753 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x4", "y": [ 31.42606824507868, 29.89978041951682, @@ -1771,7 +2024,7 @@ 25.025731203374928, 26.39365338256261 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", @@ -1812,7 +2065,7 @@ 2022, 2023 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 28.822209854620677, 23.63324016329598, @@ -1837,7 +2090,7 @@ 11.76197123902476, 13.15809619673794 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", @@ -1878,7 +2131,7 @@ 2022, 2023 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 20.473205194849207, 20.08942993636053, @@ -1903,13 +2156,51 @@ 17.05871694245511, 16.853738387852278 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#2C6496", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 22.612338871786438, + 21.683235334946502, + 22.778792818945643, + 22.70749037940664, + 22.856983510268577, + 22.726030058510364, + 22.692546246814565, + 22.819290215655226 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -1918,7 +2209,7 @@ "mode": "lines+markers", "name": "PE FRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -1930,24 +2221,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 32.37867467281448, 31.081989743908554, 34.16938471422612, - 33.99239108855113, + 33.996540232918214, 34.45032196966801, 34.25543924239135, 34.17221691393201, 34.41296285264998 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -1968,7 +2259,7 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 17.911071894499038, 15.583933162260399, @@ -1979,13 +2270,13 @@ 15.425411736471432, 15.660361558215161 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -2006,24 +2297,62 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 20.294296587662636, 19.734392709897282, 20.29129280433275, - 20.302918474749408, - 20.411299681180665, - 20.30061673376119, - 20.289191079088116, + 20.303393191342675, + 20.403811976169024, + 20.294910350002546, + 20.27953866117391, 20.350028901363675 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#17354F", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 22.865927928316154, + 22.46780542311245, + 23.147057969226548, + 23.042543073599116, + 23.04956978413251, + 23.041338445803447, + 23.45282633218145, + 23.605538795270917 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -2032,7 +2361,7 @@ "mode": "lines+markers", "name": "PE EFRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -2044,24 +2373,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 27.475809562225777, 26.89978385024922, 30.20233038593852, - 30.09300343231252, - 30.12619818104022, - 30.096755563335805, - 31.3525028938604, + 30.093360588063838, + 30.126195357857554, + 30.096752740153004, + 31.352500070677568, 31.82614906555916 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -2082,7 +2411,7 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 1.0470712686260795, 0.9509949638601656, @@ -2093,13 +2422,13 @@ 0.9565434173646432, 0.9539840160826032 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -2120,49 +2449,59 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 31.649526380215526, 31.149550909804507, 31.6697501661796, - 31.532515454257076, - 31.53879229933682, - 31.531165420787215, - 32.2598587942082, + 31.53171252568227, + 31.537677602802855, + 31.529955548317794, + 31.964635404908005, 32.129997180632074 ], - "yaxis": "y3" + "yaxis": "y2" } ], "layout": { "annotations": [ { "showarrow": false, - "text": "group=Children", - "x": 0.15999999999999998, + "text": "group=Pensioners", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Pensioners", - "x": 0.49999999999999994, + "text": "group=Working age", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Working age", - "x": 0.8399999999999999, + "text": "group=All", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.9999999999999999, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Children", + "x": 0.755, + "xanchor": "center", + "xref": "paper", + "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" } @@ -2237,6 +2576,20 @@ "y0": 0, "y1": 1, "yref": "y3 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" } ], "template": { @@ -3063,7 +3416,7 @@ "anchor": "y", "domain": [ 0, - 0.31999999999999995 + 0.49 ], "title": { "text": "Year" @@ -3072,8 +3425,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.33999999999999997, - 0.6599999999999999 + 0.51, + 1 ], "matches": "x", "title": { @@ -3083,19 +3436,26 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.6799999999999999, - 0.9999999999999999 + 0, + 0.49 ], "matches": "x", - "title": { - "text": "Year" - } + "showticklabels": false + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, - 1 + 0.46499999999999997 ], "title": { "text": "Poverty rate (%)" @@ -3105,7 +3465,7 @@ "anchor": "x2", "domain": [ 0, - 1 + 0.46499999999999997 ], "matches": "y", "showticklabels": false @@ -3113,8 +3473,19 @@ "yaxis3": { "anchor": "x3", "domain": [ - 0, - 1 + 0.5349999999999999, + 0.9999999999999999 + ], + "matches": "y", + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.5349999999999999, + 0.9999999999999999 ], "matches": "y", "showticklabels": false @@ -3150,7 +3521,7 @@ }, "data": [ { - "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "hovertemplate": "scenario=Baseline
group=All
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "Baseline", "line": { "color": "#808080", @@ -3188,7 +3559,73 @@ 2022, 2023 ], - "xaxis": "x", + "xaxis": "x3", + "y": [ + 17.763575829763358, + 17.57095454536529, + 16.8641685664779, + 17.41270044472432, + 17.88079110985456, + 18.15678430631231, + 17.93433011199858, + 16.94935348261464, + 15.9533865856187, + 15.73865235578404, + 15.41309466992854, + 15.21933105638105, + 15.853793012946191, + 16.37017843770272, + 16.24261142203756, + 17.1192252285714, + 16.73445026981139, + 17.87439753410655, + 15.84178874887928, + 16.57707523401038, + 17.02981453981571, + 17.23175507441399 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x4", "y": [ 22.1151131564807, 21.718549002731518, @@ -3213,7 +3650,7 @@ 22.32477330226203, 23.18849341106766 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", @@ -3254,7 +3691,7 @@ 2022, 2023 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 23.80551693197907, 22.741299228178562, @@ -3279,7 +3716,7 @@ 18.317054885325028, 18.642029691469382 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", @@ -3320,7 +3757,7 @@ 2022, 2023 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 14.34455671573913, 14.48979884859363, @@ -3345,13 +3782,51 @@ 14.7650673952168, 14.68902336218644 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#2C6496", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 19.73970439195313, + 19.760515806709734, + 19.94222088345337, + 20.215674307850623, + 20.194098817629495, + 20.445693107948333, + 20.42833998064357, + 20.385474407185058 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -3360,7 +3835,7 @@ "mode": "lines+markers", "name": "PE FRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -3372,24 +3847,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 27.152917482942062, 26.89965072138926, 27.344585005796198, 28.08062058278653, - 28.126367162521902, - 28.427328342833075, - 28.631744007481963, + 28.127794441313714, + 28.640618072121164, + 28.633609728093727, 28.83322431556572 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -3410,33 +3885,71 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 22.626773888557768, 23.404700120771505, 22.929393503371777, - 22.504993300740097, - 21.975432342207327, - 22.129577278355335, - 22.158160677394694, + 22.513112753052635, + 22.007276902845025, + 22.153391278310945, + 22.15892400844723, 21.29317872299489 ], + "yaxis": "y" + }, + { + "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#2C6496", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x2", + "y": [ + 16.824489159308285, + 16.79843277711673, + 17.012595039113165, + 17.25986772432548, + 17.302742679027393, + 17.488705503765534, + 17.463908508003303, + 17.489906812646378 + ], "yaxis": "y2" }, { - "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", - "legendgroup": "PE FRS", + "hovertemplate": "scenario=PE EFRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", "line": { - "color": "#ab63fa", + "color": "#17354F", "dash": "solid" }, "marker": { "symbol": "circle" }, "mode": "lines+markers", - "name": "PE FRS", + "name": "PE EFRS", "orientation": "v", - "showlegend": false, + "showlegend": true, "type": "scatter", "x": [ 2023, @@ -3450,14 +3963,14 @@ ], "xaxis": "x3", "y": [ - 16.824489159308285, - 16.79843277711673, - 17.012595039113165, - 17.26549745653385, - 17.30789674188529, - 17.437348656301502, - 17.47069594333526, - 17.489906812646378 + 12.112179592006028, + 15.620217665040506, + 15.595409650658478, + 15.573084753833905, + 15.571945487038006, + 15.725149679636797, + 15.695047204122602, + 16.141532647881565 ], "yaxis": "y3" }, @@ -3465,7 +3978,7 @@ "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -3474,7 +3987,7 @@ "mode": "lines+markers", "name": "PE EFRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -3486,24 +3999,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 19.02718051399632, 19.124112534152843, 19.154039236122518, - 19.114828585086713, - 19.11331167857437, - 19.11642440146099, - 19.020939673455338, + 19.11482892900497, + 19.112689743041358, + 19.11713363961038, + 19.02164898600129, 20.401170383647894 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -3524,24 +4037,24 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 4.450450759444146, 4.56908022933716, 4.460887103730734, 4.453385961515692, - 4.452023186826072, - 4.450501810745137, - 4.448927991586455, + 4.451326587793594, + 4.4505018091102775, + 4.44747978160458, 4.448681798625182 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -3562,49 +4075,59 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 14.280093082740947, 19.866777959980247, 19.869115546163503, - 19.843272714389297, - 19.843158872630365, - 20.08917868816643, - 20.058580242567437, + 19.84320301500398, + 19.84264084299722, + 20.089225042578736, + 20.058544494037406, 20.539113893347764 ], - "yaxis": "y3" + "yaxis": "y2" } ], "layout": { "annotations": [ { "showarrow": false, - "text": "group=Children", - "x": 0.15999999999999998, + "text": "group=Pensioners", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Pensioners", - "x": 0.49999999999999994, + "text": "group=Working age", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Working age", - "x": 0.8399999999999999, + "text": "group=All", + "x": 0.245, + "xanchor": "center", + "xref": "paper", + "y": 0.9999999999999999, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Children", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" } @@ -3679,6 +4202,20 @@ "y0": 0, "y1": 1, "yref": "y3 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" } ], "template": { @@ -4505,7 +5042,7 @@ "anchor": "y", "domain": [ 0, - 0.31999999999999995 + 0.49 ], "title": { "text": "Year" @@ -4514,8 +5051,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.33999999999999997, - 0.6599999999999999 + 0.51, + 1 ], "matches": "x", "title": { @@ -4525,19 +5062,26 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.6799999999999999, - 0.9999999999999999 + 0, + 0.49 ], "matches": "x", - "title": { - "text": "Year" - } + "showticklabels": false + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, - 1 + 0.46499999999999997 ], "title": { "text": "Poverty rate (%)" @@ -4547,7 +5091,7 @@ "anchor": "x2", "domain": [ 0, - 1 + 0.46499999999999997 ], "matches": "y", "showticklabels": false @@ -4555,8 +5099,19 @@ "yaxis3": { "anchor": "x3", "domain": [ - 0, - 1 + 0.5349999999999999, + 0.9999999999999999 + ], + "matches": "y", + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.5349999999999999, + 0.9999999999999999 ], "matches": "y", "showticklabels": false @@ -4592,7 +5147,7 @@ }, "data": [ { - "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "hovertemplate": "scenario=Baseline
group=All
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "Baseline", "line": { "color": "#808080", @@ -4630,7 +5185,73 @@ 2022, 2023 ], - "xaxis": "x", + "xaxis": "x3", + "y": [ + 22.13454328483212, + 21.33657983481736, + 20.44097700656872, + 21.41823984099182, + 22.35312505294376, + 22.455536834238142, + 22.21027778585539, + 22.15214250623417, + 21.0934490241877, + 20.92694325683713, + 20.99518454730141, + 20.962524483140747, + 21.126929767292747, + 21.76376976121061, + 22.05156660050747, + 21.58441092565285, + 21.93354149305797, + 22.032464711582563, + 20.34960528196433, + 21.67926291196815, + 21.4050230573135, + 21.10472396979548 + ], + "yaxis": "y3" + }, + { + "hovertemplate": "scenario=Baseline
group=Children
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "Baseline", + "line": { + "color": "#808080", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "Baseline", + "orientation": "v", + "showlegend": false, + "type": "scatter", + "x": [ + 2002, + 2003, + 2004, + 2005, + 2006, + 2007, + 2008, + 2009, + 2010, + 2011, + 2012, + 2013, + 2014, + 2015, + 2016, + 2017, + 2018, + 2019, + 2020, + 2021, + 2022, + 2023 + ], + "xaxis": "x4", "y": [ 29.207015801079876, 28.363787858777577, @@ -4655,7 +5276,7 @@ 29.9144181073631, 30.51705063293655 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=Baseline
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", @@ -4696,7 +5317,7 @@ 2022, 2023 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 23.871294422585933, 20.39193228696699, @@ -4721,7 +5342,7 @@ 15.85668028450148, 15.664066099520019 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=Baseline
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", @@ -4762,7 +5383,7 @@ 2022, 2023 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 19.00294643203232, 19.04135921606549, @@ -4787,13 +5408,51 @@ 19.9877072319224, 19.34954598744519 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE FRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE FRS", + "line": { + "color": "#2C6496", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE FRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 25.605509797645194, + 25.726594453327888, + 25.966795453659042, + 26.09289224663098, + 26.145996228166464, + 26.330011293090855, + 26.247290342543252, + 26.4310126779833 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE FRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -4802,7 +5461,7 @@ "mode": "lines+markers", "name": "PE FRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -4814,24 +5473,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 38.074027115607194, 38.132976278030114, 38.7929603099011, - 39.08794105223388, - 39.344429146822264, - 39.716865268350844, - 39.70857402020221, + 39.05901956323598, + 39.31550765313318, + 39.68230575040613, + 39.674014498702505, 40.05994977935245 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE FRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -4852,7 +5511,7 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 21.67594788656187, 21.79878403709025, @@ -4863,13 +5522,13 @@ 19.51659014255231, 19.903722914243325 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE FRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE FRS", "line": { - "color": "#ab63fa", + "color": "#2C6496", "dash": "solid" }, "marker": { @@ -4890,24 +5549,62 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 22.27508934587312, 22.41596292067644, 22.772448250609866, - 22.953907682555133, - 23.02354309414439, - 23.20391825714952, - 23.143666557831803, + 22.93780772960098, + 23.00346556588249, + 23.172420646557622, + 23.108326756614563, 23.190213189203355 ], + "yaxis": "y2" + }, + { + "hovertemplate": "scenario=PE EFRS
group=All
Year=%{x}
Poverty rate (%)=%{y}", + "legendgroup": "PE EFRS", + "line": { + "color": "#17354F", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines+markers", + "name": "PE EFRS", + "orientation": "v", + "showlegend": true, + "type": "scatter", + "x": [ + 2023, + 2024, + 2025, + 2026, + 2027, + 2028, + 2029, + 2030 + ], + "xaxis": "x3", + "y": [ + 27.333375009188448, + 27.447937447518463, + 29.055715474709743, + 29.059400961039493, + 29.075411691729936, + 29.0782595097354, + 29.07900181283263, + 29.23835424527985 + ], "yaxis": "y3" }, { "hovertemplate": "scenario=PE EFRS
group=Children
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -4916,7 +5613,7 @@ "mode": "lines+markers", "name": "PE EFRS", "orientation": "v", - "showlegend": true, + "showlegend": false, "type": "scatter", "x": [ 2023, @@ -4928,24 +5625,24 @@ 2029, 2030 ], - "xaxis": "x", + "xaxis": "x4", "y": [ 33.22568241790446, 33.21473474231569, 36.072618355666776, - 36.07533386150587, - 36.17358685847445, - 36.162613873521686, - 36.17348568555037, + 36.06940397245611, + 36.155053415471244, + 36.15534423728931, + 36.16348793772855, 37.00268393208157 ], - "yaxis": "y" + "yaxis": "y4" }, { "hovertemplate": "scenario=PE EFRS
group=Pensioners
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -4966,24 +5663,24 @@ 2029, 2030 ], - "xaxis": "x2", + "xaxis": "x", "y": [ 4.289363566365633, 4.3004837184269205, 4.285412803968219, 4.277988540768014, - 4.275074553933701, + 4.275020178355927, 4.273565132863523, 4.2714045176426225, 4.275409971626422 ], - "yaxis": "y2" + "yaxis": "y" }, { "hovertemplate": "scenario=PE EFRS
group=Working age
Year=%{x}
Poverty rate (%)=%{y}", "legendgroup": "PE EFRS", "line": { - "color": "#FFA15A", + "color": "#17354F", "dash": "solid" }, "marker": { @@ -5004,49 +5701,59 @@ 2029, 2030 ], - "xaxis": "x3", + "xaxis": "x2", "y": [ 36.433063103612724, 36.6147682281975, 38.718867852550844, - 38.73470137317763, - 38.753869243999645, - 38.75422381006287, - 38.75631001431661, + 38.72862602013536, + 38.74092076723748, + 38.746100277281315, + 38.746836556877476, 38.85676586978203 ], - "yaxis": "y3" + "yaxis": "y2" } ], "layout": { "annotations": [ { "showarrow": false, - "text": "group=Children", - "x": 0.15999999999999998, + "text": "group=Pensioners", + "x": 0.245, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Pensioners", - "x": 0.49999999999999994, + "text": "group=Working age", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.46499999999999997, "yanchor": "bottom", "yref": "paper" }, { "showarrow": false, - "text": "group=Working age", - "x": 0.8399999999999999, + "text": "group=All", + "x": 0.245, + "xanchor": "center", + "xref": "paper", + "y": 0.9999999999999999, + "yanchor": "bottom", + "yref": "paper" + }, + { + "showarrow": false, + "text": "group=Children", + "x": 0.755, "xanchor": "center", "xref": "paper", - "y": 1, + "y": 0.9999999999999999, "yanchor": "bottom", "yref": "paper" } @@ -5121,6 +5828,20 @@ "y0": 0, "y1": 1, "yref": "y3 domain" + }, + { + "line": { + "color": "gray", + "dash": "dot" + }, + "opacity": 0.5, + "type": "line", + "x0": 2023, + "x1": 2023, + "xref": "x4", + "y0": 0, + "y1": 1, + "yref": "y4 domain" } ], "template": { @@ -5947,7 +6668,7 @@ "anchor": "y", "domain": [ 0, - 0.31999999999999995 + 0.49 ], "title": { "text": "Year" @@ -5956,8 +6677,8 @@ "xaxis2": { "anchor": "y2", "domain": [ - 0.33999999999999997, - 0.6599999999999999 + 0.51, + 1 ], "matches": "x", "title": { @@ -5967,19 +6688,26 @@ "xaxis3": { "anchor": "y3", "domain": [ - 0.6799999999999999, - 0.9999999999999999 + 0, + 0.49 ], "matches": "x", - "title": { - "text": "Year" - } + "showticklabels": false + }, + "xaxis4": { + "anchor": "y4", + "domain": [ + 0.51, + 1 + ], + "matches": "x", + "showticklabels": false }, "yaxis": { "anchor": "x", "domain": [ 0, - 1 + 0.46499999999999997 ], "title": { "text": "Poverty rate (%)" @@ -5989,7 +6717,7 @@ "anchor": "x2", "domain": [ 0, - 1 + 0.46499999999999997 ], "matches": "y", "showticklabels": false @@ -5997,8 +6725,19 @@ "yaxis3": { "anchor": "x3", "domain": [ - 0, - 1 + 0.5349999999999999, + 0.9999999999999999 + ], + "matches": "y", + "title": { + "text": "Poverty rate (%)" + } + }, + "yaxis4": { + "anchor": "x4", + "domain": [ + 0.5349999999999999, + 0.9999999999999999 ], "matches": "y", "showticklabels": false From b349a854e6b91de2aacd3f05023e4e5e5c57299a Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Wed, 10 Sep 2025 14:51:16 +0100 Subject: [PATCH 3/4] Update NB --- docs/book/validation/hbai-poverty-rates.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/book/validation/hbai-poverty-rates.ipynb b/docs/book/validation/hbai-poverty-rates.ipynb index 18601f551..01e3389e1 100644 --- a/docs/book/validation/hbai-poverty-rates.ipynb +++ b/docs/book/validation/hbai-poverty-rates.ipynb @@ -6756,7 +6756,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "policyengine", "language": "python", "name": "python3" }, @@ -6770,7 +6770,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.0" + "version": "3.13.5" } }, "nbformat": 4, From d6a20644d7b061f8a0c3a66fb339c87feb61642c Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff Date: Sat, 20 Sep 2025 14:42:09 +0100 Subject: [PATCH 4/4] master -> main --- .github/workflows/code_changes.yaml | 4 ++-- .github/workflows/deploy.yml | 2 +- .github/workflows/pr_code_changes.yaml | 4 ++-- .github/workflows/pr_docs_changes.yaml | 2 +- .github/workflows/versioning.yaml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code_changes.yaml b/.github/workflows/code_changes.yaml index 7b7bff328..6c51b81ea 100644 --- a/.github/workflows/code_changes.yaml +++ b/.github/workflows/code_changes.yaml @@ -4,10 +4,10 @@ name: Code changes on: push: branches: - - master + - main paths: - - policyengine_uk/** + - src/** - tests/** - .github/** workflow_dispatch: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9141f4e75..c0caf0b4f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ name: Deploy documentation on: push: # Runs on pushes targeting the default branch - branches: [master] + branches: [main] env: # `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from. # E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`. diff --git a/.github/workflows/pr_code_changes.yaml b/.github/workflows/pr_code_changes.yaml index ba99f4f9e..ecf0c35ee 100644 --- a/.github/workflows/pr_code_changes.yaml +++ b/.github/workflows/pr_code_changes.yaml @@ -4,10 +4,10 @@ name: Code changes on: pull_request: branches: - - master + - main paths: - - policyengine_uk/** + - src/** - tests/** - .github/** workflow_dispatch: diff --git a/.github/workflows/pr_docs_changes.yaml b/.github/workflows/pr_docs_changes.yaml index 088d9f202..e769642ac 100644 --- a/.github/workflows/pr_docs_changes.yaml +++ b/.github/workflows/pr_docs_changes.yaml @@ -4,7 +4,7 @@ name: Docs changes on: pull_request: branches: - - master + - main paths: - docs/** diff --git a/.github/workflows/versioning.yaml b/.github/workflows/versioning.yaml index f92eedacf..16746f985 100644 --- a/.github/workflows/versioning.yaml +++ b/.github/workflows/versioning.yaml @@ -4,7 +4,7 @@ name: Versioning updates on: push: branches: - - master + - main paths: - changelog_entry.yaml