.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/lines_and_polygons/nightshade.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_gallery_lines_and_polygons_nightshade.py: Nightshade feature ------------------ Draws a polygon where there is no sunlight for the given datetime. .. GENERATED FROM PYTHON SOURCE LINES 8-25 .. image-sg:: /gallery/lines_and_polygons/images/sphx_glr_nightshade_001.png :alt: Night time shading for 1999-12-31 12:00:00 :srcset: /gallery/lines_and_polygons/images/sphx_glr_nightshade_001.png :class: sphx-glr-single-img .. code-block:: Python import datetime import matplotlib.pyplot as plt import cartopy.crs as ccrs from cartopy.feature.nightshade import Nightshade fig = plt.figure(figsize=(10, 5)) ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) date = datetime.datetime(1999, 12, 31, 12) ax.set_title(f'Night time shading for {date}') ax.stock_img() ax.add_feature(Nightshade(date, alpha=0.2)) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.305 seconds) .. _sphx_glr_download_gallery_lines_and_polygons_nightshade.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: nightshade.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: nightshade.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_