.. _sphx_glr_examples_plot_timeseries.py:


====================
Plot Timeseries Data
====================





.. image:: /examples/images/sphx_glr_plot_timeseries_001.png
    :align: center


.. rst-class:: sphx-glr-script-out

 Out::

    model scenario  region       variable       unit  year  \
    9   MESSAGE-GLOBIOM  SSP2-26  R5ASIA  Emissions|CO2  Mt CO2/yr  2005   
    15  MESSAGE-GLOBIOM  SSP2-26   R5LAM  Emissions|CO2  Mt CO2/yr  2005   
    12  MESSAGE-GLOBIOM  SSP2-26   R5MAF  Emissions|CO2  Mt CO2/yr  2005   
    3   MESSAGE-GLOBIOM  SSP2-26  R5OECD  Emissions|CO2  Mt CO2/yr  2005   
    6   MESSAGE-GLOBIOM  SSP2-26   R5REF  Emissions|CO2  Mt CO2/yr  2005   

            value  
    9   10488.011  
    15   5086.483  
    12   4474.073  
    3   14486.522  
    6    2742.073




|


.. code-block:: python

    import matplotlib.pyplot as plt
    import pyam

    fname = 'data.csv'

    df = pyam.IamDataFrame(fname, encoding='ISO-8859-1')

    df = (df
          .filter({'variable': 'Emissions|CO2'})
          .filter({'region': 'World'}, keep=False)
          )

    print(df.head())

    fig, ax = plt.subplots(figsize=(8, 8))
    df.line_plot(ax=ax, color='region')
    plt.show()

**Total running time of the script:** ( 0 minutes  15.438 seconds)



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: plot_timeseries.py <plot_timeseries.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: plot_timeseries.ipynb <plot_timeseries.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_