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

.. only:: html

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

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

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

.. _sphx_glr_examples_logos_plot_hyoga_logo.py:


Hyoga logo
==========

Plot hyoga logo and favicon and including glaciers and paleoglaciers.

.. GENERATED FROM PYTHON SOURCE LINES 11-74

.. code-block:: Python


    import matplotlib.pyplot as plt
    import hyoga


    def get_height_dots(fig):
        """Return the figure height in dots."""
        return fig.get_window_extent().height/fig.dpi*72


    def plot_favicon(figsize=None, rect=None, color='0.25'):
        """Plot main part of the logo."""

        # initialize figure
        fig = plt.figure(figsize=(9.6, 9.6) if figsize is None else figsize)
        ax = fig.add_axes([3/32, 5/128, 13/16, 13/16] if rect is None else rect)

        # add continents and glaciers
        crs = '+a=6378137 +proj=ortho +lon_0=-45 +lat_0=90'
        hyoga.open.natural_earth(
            'admin_0_countries', category='cultural', scale='110m')\
            .to_crs(crs).plot(ax=ax, alpha=0.25, facecolor=color)
        hyoga.open.paleoglaciers('ehl11').to_crs(crs).plot(
            ax=ax, alpha=0.75, facecolor=color)
        hyoga.open.natural_earth('glaciated_areas', scale='50m').to_crs(crs).plot(
            ax=ax, edgecolor=color, facecolor=color)

        # add circle for the o
        ax.add_patch(plt.Circle(
            (0, 0), 6.4e6, capstyle='round', clip_on=False, edgecolor=color,
            facecolor='none', linewidth=5/64*get_height_dots(fig)))

        # add overline (in default fig coords this is [1/4, 3/4], 15/16, 1)
        ax.fill_between(
            [5/26, 21/26], 115/104, 123/104, clip_on=False, facecolor=color,
            transform=ax.transAxes)

        # set axes properties
        ax.patch.set_facecolor('none')
        ax.set_xlim((-6.4e6, 6.4e6))
        ax.set_ylim((-6.4e6, 6.4e6))
        ax.axis('off')

        # return figure
        return fig


    def plot_logo(color='0.25'):
        """Plot full logo with text."""

        # plot favicon with wide layout
        fig = plot_favicon(
            figsize=(9.6, 3.2), rect=[17/48, 5/128, 14/48, 13/16], color=color)

        # add text and overline
        fig.text(
            1/2, 0, 'hy  ga', color=color, family='monospace', ha='center',
            va='bottom', fontsize=7/8*get_height_dots(fig))

        # return figure
        return fig









.. GENERATED FROM PYTHON SOURCE LINES 75-76

Full logo with package name

.. GENERATED FROM PYTHON SOURCE LINES 76-79

.. code-block:: Python

    plot_logo()
    plt.show()




.. image-sg:: /examples/logos/images/sphx_glr_plot_hyoga_logo_001.png
   :alt: plot hyoga logo
   :srcset: /examples/logos/images/sphx_glr_plot_hyoga_logo_001.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

    downloading https://naturalearth.s3.amazonaws.com/110m_cultural/ne_110m_admin_0_countries.zip...
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    downloading https://naturalearth.s3.amazonaws.com/50m_physical/ne_50m_glaciated_areas.zip...




.. GENERATED FROM PYTHON SOURCE LINES 80-81

Small logo for the favicon

.. GENERATED FROM PYTHON SOURCE LINES 81-83

.. code-block:: Python

    plot_favicon()
    plt.show()



.. image-sg:: /examples/logos/images/sphx_glr_plot_hyoga_logo_002.png
   :alt: plot hyoga logo
   :srcset: /examples/logos/images/sphx_glr_plot_hyoga_logo_002.png
   :class: sphx-glr-single-img


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

 .. code-block:: none

    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)
    /home/docs/checkouts/readthedocs.org/user_builds/hyoga/envs/stable/lib/python3.12/site-packages/shapely/constructive.py:829: RuntimeWarning: invalid value encountered in normalize
      return lib.normalize(geometry, **kwargs)





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

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


.. _sphx_glr_download_examples_logos_plot_hyoga_logo.py:

.. only:: html

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

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

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

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

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_hyoga_logo.zip <plot_hyoga_logo.zip>`


.. only:: html

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

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