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

.. only:: html

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

        :ref:`Go to the end <sphx_glr_download_examples_plot-set-extent.py>`
        to download the full example code.

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

.. _sphx_glr_examples_plot-set-extent.py:


================================
Plot a small area with landmarks
================================

You can use :meth:`.Axes.set_extent()` to display a region of interest on a plot.
Combined with :func:`add_landmarks()` to highlight regional landmarks.

.. GENERATED FROM PYTHON SOURCE LINES 9-38



.. image-sg:: /examples/images/sphx_glr_plot-set-extent_001.png
   :alt: Sea surface temperature around Mackay
   :srcset: /examples/images/sphx_glr_plot-set-extent_001.png
   :class: sphx-glr-single-img





.. code-block:: Python

    import emsarray.plot
    import shapely
    from matplotlib import pyplot

    dataset = emsarray.tutorial.open_dataset('gbr4')

    # Set up the figure
    figure = pyplot.figure()
    axes = figure.add_subplot(projection=dataset.ems.data_crs)
    axes.set_title("Sea surface temperature around Mackay")
    axes.set_aspect('equal', adjustable='datalim')
    emsarray.plot.add_coast(axes, zorder=1)

    # Focus on the area of interest
    axes.set_extent((148.245710, 151.544167, -19.870197, -21.986412))

    # Plot the temperature
    temperature = dataset.ems.make_artist(
        axes, dataset['temp'].isel(time=0, k=-1),
        cmap='GnBu', clim=(24, 28), edgecolor='face', zorder=0)

    # Name key locations
    emsarray.plot.add_landmarks(axes, [
        ('The Percy Group', shapely.Point(150.270579, -21.658269)),
        ('Whitsundays', shapely.Point(148.955319, -20.169076)),
        ('Mackay', shapely.Point(149.192671, -21.146719)),
    ])

    pyplot.show()


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

   **Total running time of the script:** (1 minutes 10.090 seconds)


.. _sphx_glr_download_examples_plot-set-extent.py:

.. only:: html

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

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

      :download:`Download Jupyter notebook: plot-set-extent.ipynb <plot-set-extent.ipynb>`

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

      :download:`Download Python source code: plot-set-extent.py <plot-set-extent.py>`

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

      :download:`Download zipped: plot-set-extent.zip <plot-set-extent.zip>`


.. only:: html

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

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