.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/miscellanea/logo.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. 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_miscellanea_logo.py: Cartopy Logo ------------ The actual code to produce cartopy's logo. .. GENERATED FROM PYTHON SOURCE LINES 8-48 .. image-sg:: /gallery/miscellanea/images/sphx_glr_logo_001.png :alt: logo :srcset: /gallery/miscellanea/images/sphx_glr_logo_001.png :class: sphx-glr-single-img .. code-block:: default import cartopy.crs as ccrs import matplotlib.pyplot as plt import matplotlib.textpath import matplotlib.patches import matplotlib.transforms from matplotlib.font_manager import FontProperties def main(): fig = plt.figure(figsize=[12, 6]) ax = fig.add_subplot(1, 1, 1, projection=ccrs.Robinson()) ax.coastlines() ax.gridlines() # generate a matplotlib path representing the word "cartopy" fp = FontProperties(family='DejaVu Sans', weight='bold') logo_path = matplotlib.textpath.TextPath((-175, -35), 'cartopy', size=80, prop=fp) # scale the letters up to sensible longitude and latitude sizes transform = matplotlib.transforms.Affine2D().scale(1, 2).translate(0, 35) # add a background image im = ax.stock_img() # Apply the scale transform and then the map coordinate transform plate_carree_transform = (transform + ccrs.PlateCarree()._as_mpl_transform(ax)) # add the path as a patch, drawing black outlines around the text patch = matplotlib.patches.PathPatch(logo_path, facecolor='none', edgecolor='black', transform=plate_carree_transform) im.set_clip_path(patch) ax.add_patch(patch) plt.show() if __name__ == '__main__': main() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.275 seconds) .. _sphx_glr_download_gallery_miscellanea_logo.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: logo.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: logo.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_