
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "_gallery\plot_wp_leaf.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download__gallery_plot_wp_leaf.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr__gallery_plot_wp_leaf.py:


Leaf water potential
====================

plot extracted wp_leaf to compare to article
figure 5

.. GENERATED FROM PYTHON SOURCE LINES 8-37



.. image-sg:: /_gallery/images/sphx_glr_plot_wp_leaf_001.png
   :alt: spring, fall
   :srcset: /_gallery/images/sphx_glr_plot_wp_leaf_001.png
   :class: sphx-glr-single-img





.. code-block:: default

    import matplotlib.pyplot as plt
    import pandas as pd

    from alsina2011 import pth_clean

    # read data
    df = pd.read_csv(pth_clean / "wp_leaf.csv", sep=";", comment="#", parse_dates=['date'], index_col=['when', 'date'])

    # plot data
    fig, axes = plt.subplots(1, 2, sharex='all', sharey='all', figsize=(11, 6), squeeze=False)

    for i, season in enumerate(['spring', 'fall']):
        ax = axes[0, i]
        for rootstock, sdf in df.loc[season].groupby(by='rootstock'):
            time = sdf.index.hour + sdf.index.minute / 60
            ax.plot(time, sdf['wp'].values, 'o-', label=rootstock)

        ax.set_title(season)

    ax = axes[0, 0]
    ax.set_ylim(-1.6, 0)
    ax.legend()
    ax.set_ylabel("wp leaf [MPa]")
    for i in (0, 1):
        axes[0, i].set_xticks(range(4, 21, 4))
        axes[0, i].set_xlabel("")

    fig.tight_layout()
    plt.show()


.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download__gallery_plot_wp_leaf.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example




    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-jupyter

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


.. only:: html

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

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