.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_favicon.py: Cartopy Favicon --------------- The actual code to generate cartopy's favicon. .. image:: /gallery/images/sphx_glr_favicon_001.png :class: sphx-glr-single-img .. code-block:: python import cartopy.crs as ccrs import matplotlib.pyplot as plt import matplotlib.textpath import matplotlib.patches from matplotlib.font_manager import FontProperties import numpy as np 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='Bitstream Vera Sans', weight='bold') logo_path = matplotlib.textpath.TextPath((-4.5e7, -3.7e7), 'C', size=1, prop=fp) # Scale the letter up to an appropriate X and Y scale. logo_path._vertices *= np.array([103250000, 103250000]) # 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() **Total running time of the script:** ( 0 minutes 1.213 seconds) .. _sphx_glr_download_gallery_favicon.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: favicon.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: favicon.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_