.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "generated_examples\annuallife\plot_scr_radar_tradlife_a_ex1.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_generated_examples_annuallife_plot_scr_radar_tradlife_a_ex1.py: TradLife_A_EX1: Life SCR radar chart ==================================== Radar charts of the Solvency II life sub-risk capital requirements for selected policies, projected by the :mod:`~annuallife` ``TradLife_A_EX1`` model. Each spoke of the radar chart represents a life sub-risk (:func:`~annuallife.TradLife_A.Projection.risk_life_sub`), and each ring shows the sizes of those sub-risks at a projection time ``t``. .. seealso:: * The :mod:`~annuallife` library .. GENERATED FROM PYTHON SOURCE LINES 14-46 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /generated_examples/annuallife/images/sphx_glr_plot_scr_radar_tradlife_a_ex1_001.png :alt: Policy index: 40 :srcset: /generated_examples/annuallife/images/sphx_glr_plot_scr_radar_tradlife_a_ex1_001.png :class: sphx-glr-multi-img * .. image-sg:: /generated_examples/annuallife/images/sphx_glr_plot_scr_radar_tradlife_a_ex1_002.png :alt: Policy index: 170 :srcset: /generated_examples/annuallife/images/sphx_glr_plot_scr_radar_tradlife_a_ex1_002.png :class: sphx-glr-multi-img .. code-block:: Python import modelx as mx import pandas as pd from draw_charts_radar import draw_radar model = mx.read_model("TradLife_A_EX1") LifeRiskID = model.Enums.LifeRiskID # (label, LifeRiskID code) for each radar spoke risks = [('mort', LifeRiskID.MORT), ('longev', LifeRiskID.LONGV), ('disab', LifeRiskID.DISAB), ('exps', LifeRiskID.EXPS), ('lapse', LifeRiskID.LAPSE)] def draw(idx): proj = model.Projection[idx] data = {} for t in range(0, 20, 5): data['t=' + str(t)] = pd.Series( {label: proj.risk_life_sub(t, risk) for label, risk in risks}) draw_radar(pd.DataFrame(data), ax_title='Policy index: ' + str(idx), fig_title='SCR Life Risks') # idx 40 / 170 correspond to PolicyID 41 / 171 in simplelife (0-based). for i in (40, 170): draw(i) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.654 seconds) .. _sphx_glr_download_generated_examples_annuallife_plot_scr_radar_tradlife_a_ex1.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_scr_radar_tradlife_a_ex1.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_scr_radar_tradlife_a_ex1.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_scr_radar_tradlife_a_ex1.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_