.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/miscellanea/favicon.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_miscellanea_favicon.py: Cartopy Favicon --------------- The actual code to generate cartopy's favicon. .. GENERATED FROM PYTHON SOURCE LINES 8-39 .. image-sg:: /gallery/miscellanea/images/sphx_glr_favicon_001.png :alt: favicon :srcset: /gallery/miscellanea/images/sphx_glr_favicon_001.png :class: sphx-glr-single-img .. code-block:: default from matplotlib.font_manager import FontProperties import matplotlib.patches import matplotlib.pyplot as plt import matplotlib.textpath import cartopy.crs as ccrs def main(): fig = plt.figure(figsize=[8, 8]) ax = fig.add_subplot(1, 1, 1, projection=ccrs.SouthPolarStereo()) ax.coastlines() ax.gridlines() ax.stock_img() # Generate a matplotlib path representing the character "C". fp = FontProperties(family='DejaVu Sans', weight='bold') logo_path = matplotlib.textpath.TextPath((-4.5e7, -3.7e7), 'C', size=103250000, prop=fp) # Add the path as a patch, drawing black outlines around the text. patch = matplotlib.patches.PathPatch(logo_path, facecolor='white', edgecolor='black', linewidth=10, transform=ccrs.SouthPolarStereo()) ax.add_patch(patch) plt.show() if __name__ == '__main__': main() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 1.208 seconds) .. _sphx_glr_download_gallery_miscellanea_favicon.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: favicon.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: favicon.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_