.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/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_auto_examples_plot_timeseries.py: ============================================== Extract and Plot cGENIE Time Series data ============================================== This example shows how to read in and plot cGENIE time series data. .. GENERATED FROM PYTHON SOURCE LINES 8-24 .. image-sg:: /auto_examples/images/sphx_glr_plot_timeseries_001.png :alt: plot timeseries :srcset: /auto_examples/images/sphx_glr_plot_timeseries_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/cgeniepy/envs/stable/lib/python3.12/site-packages/cgeniepy/model.py:58: UserWarning: No gemflag is provided, use default gemflags: [biogem] warnings.warn("No gemflag is provided, use default gemflags: [biogem]") [] | .. code-block:: Python import cgeniepy import matplotlib.pyplot as plt from cgeniepy.table import ScatterData ## read in the model model = cgeniepy.sample_model() temp = model.get_ts("ocn_temp") o2 = model.get_ts("ocn_O2") ## merge both and convert to ScatterData format ts_data = ScatterData(temp.merge(o2, on="time (yr)")) ts_data.set_index("time (yr)") fig, axs = plt.subplots(2, 1) ts_data.plot(var="temperature (C)", ax=axs[0], kind='line') ts_data.plot(var="surface O2 (mol kg-1)", ax=axs[1], kind='line') .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.120 seconds) .. _sphx_glr_download_auto_examples_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 ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_timeseries.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_