.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_timeseries.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_gallery_plot_timeseries.py: ====================== Timeseries data charts ====================== .. GENERATED FROM PYTHON SOURCE LINES 9-19 Read in tutorial data and show a summary **************************************** This gallery uses the scenario data from the first-steps tutorial. If you haven't cloned the **pyam** GitHub repository to your machine, you can download the file from https://github.com/IAMconsortium/pyam/tree/main/docs/tutorials. Make sure to place the data file in the same folder as this script/notebook. .. GENERATED FROM PYTHON SOURCE LINES 19-25 .. code-block:: Python import pyam df = pyam.IamDataFrame("tutorial_data.csv") df .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/pyam-iamc/checkouts/latest/pyam/utils.py:318: FutureWarning: The previous implementation of stack is deprecated and will be removed in a future version of pandas. See the What's New notes for pandas 2.1.0 for details. Specify future_stack=True to adopt the new implementation and silence this warning. Index: * model : AIM/CGE 2.1, GENeSYS-MOD 1.0, ... WITCH-GLOBIOM 4.4 (8) * scenario : 1.0, CD-LINKS_INDCi, CD-LINKS_NPi, ... Faster Transition Scenario (8) Timeseries data coordinates: region : R5ASIA, R5LAM, R5MAF, R5OECD90+EU, R5REF, R5ROWO, World (7) variable : ... (6) unit : EJ/yr, Mt CO2/yr, °C (3) year : 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, ... 2100 (10) .. GENERATED FROM PYTHON SOURCE LINES 26-33 A simple line chart ******************* We show a simple line chart of the regional components of CO2 emissions for one scenario. Then, also show the data as a wide IAMC-style dataframe. .. GENERATED FROM PYTHON SOURCE LINES 33-42 .. code-block:: Python model, scenario = "REMIND-MAgPIE 1.7-3.0", "CD-LINKS_INDCi" data = df.filter(model=model, scenario=scenario, variable="Emissions|CO2").filter( region="World", keep=False ) data.plot(color="region", title="CO2 emissions by region") data.timeseries() .. image-sg:: /gallery/images/sphx_glr_plot_timeseries_001.png :alt: CO2 emissions by region :srcset: /gallery/images/sphx_glr_plot_timeseries_001.png :class: sphx-glr-single-img .. raw:: html
2010 2020 2030 2040 2050 2060 2070 2080 2090 2100
model scenario region variable unit
REMIND-MAgPIE 1.7-3.0 CD-LINKS_INDCi R5ASIA Emissions|CO2 Mt CO2/yr 13319.0940 17953.8288 18860.5696 20919.9611 21346.1127 20797.3295 20655.9721 20852.5609 19611.0956 18684.4507
R5LAM Emissions|CO2 Mt CO2/yr 3841.7418 4100.6996 3293.7924 2044.4228 2348.7068 2546.6130 2466.7808 2357.3265 2160.2127 1898.8835
R5MAF Emissions|CO2 Mt CO2/yr 3338.4200 5794.1257 7223.7294 8619.6929 10859.7901 12689.7547 13635.7874 14349.2884 14149.6996 13582.5528
R5OECD90+EU Emissions|CO2 Mt CO2/yr 13425.7405 11886.5214 9499.4507 8374.9951 7484.1184 6456.2150 5624.2110 5243.8898 4656.6352 4315.5721
R5REF Emissions|CO2 Mt CO2/yr 1437.8754 1692.1186 1856.6008 1959.4409 2085.8475 2021.2251 1720.9301 1374.2122 1067.1381 894.9409


.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.349 seconds) .. _sphx_glr_download_gallery_plot_timeseries.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_timeseries.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_timeseries.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_