.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/plot_05_labels.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_plot_05_labels.py: Automatic labels ================ ``LabelLayer`` places place names by simulated annealing to limit overlaps. Here the mainland region names, over a European background. .. GENERATED FROM PYTHON SOURCE LINES 8-43 .. raw:: html HAUTS- DE-FRANCE HAUTS- DE-FRANCE NORMANDIE NORMANDIE GRAND EST GRAND EST BOURGOGNE- FRANCHE-COMTÉ BOURGOGNE- FRANCHE-COMTÉ ILE-DE- FRANCE ILE-DE- FRANCE CENTRE- VAL DE LOIRE CENTRE- VAL DE LOIRE AUVERGNE- RHÔNE-ALPES AUVERGNE- RHÔNE-ALPES PROVENCE-ALPES- COTE-D'AZUR PROVENCE-ALPES- COTE-D'AZUR OCCITANIE OCCITANIE NOUVELLE- AQUITAINE NOUVELLE- AQUITAINE PAYS-DE- LA-LOIRE PAYS-DE- LA-LOIRE BRETAGNE BRETAGNE CORSE CORSE BASSE- NORMANDIE BASSE- NORMANDIE NORD-PAS- DE-CALAIS NORD-PAS- DE-CALAIS PICARDIE PICARDIE HAUTE- NORMANDIE HAUTE- NORMANDIE CHAMPAGNE- ARDENNE CHAMPAGNE- ARDENNE LORRAINE LORRAINE ALSACE ALSACE FRANCHE- COMTE FRANCHE- COMTE BOURGOGNE BOURGOGNE RHONE-ALPES RHONE-ALPES LANGUEDOC- ROUSSILLON LANGUEDOC- ROUSSILLON AUVERGNE AUVERGNE LIMOUSIN LIMOUSIN AQUITAINE AQUITAINE POITOU- CHARENTE POITOU- CHARENTE GUYANE GUYANE MARTINIQUE MARTINIQUE GUADELOUPE GUADELOUPE MAYOTTE MAYOTTE LA REUNION LA REUNION NOUVELLE- CALEDONIE NOUVELLE- CALEDONIE POLYNESIE FRANCAISE POLYNESIE FRANCAISE Guadeloupe Martinique French Guiana Reunion Mayotte Basemap: Natural Earth, IGN ADMIN-EXPRESS Regions of mainland France .. code-block:: Python from mappyng import Map, BasemapLayer, LabelLayer, VectorLayer from mappyng.data import load_france_regions, load_europe europe = load_europe().to_crs(2154) regions = load_france_regions().to_crs(2154) bbox_metro = [90000, 6040000, 1280000, 7150000] cartouches = { 0: {"bbox": [-6890454, 1780151, -6799589, 1874186], "crs": 3857, "cartouche_title": "Guadeloupe", "cartouche_title_size": 7, "border_radius": 6, "box_shadow": True}, 1: {"bbox": [-6826862, 1609607, -6759494, 1685367], "crs": 3857, "cartouche_title": "Martinique", "cartouche_title_size": 7, "border_radius": 6, "box_shadow": True}, 2: {"bbox": [-6136680, 235261, -5707791, 671780], "crs": 3857, "cartouche_title": "French Guiana", "cartouche_title_size": 7, "border_radius": 6, "box_shadow": True}, 3: {"bbox": [6136383, -2448160, 6226316, -2366992], "crs": 3857, "cartouche_title": "Reunion", "cartouche_title_size": 7, "border_radius": 6, "box_shadow": True}, 4: {"bbox": [5006226, -1459183, 5050208, -1416184], "crs": 3857, "cartouche_title": "Mayotte", "cartouche_title_size": 7, "border_radius": 6, "box_shadow": True}, } m = Map(europe, bbox=bbox_metro, width=900, height=1000, padding=25, facecolor="#eceff4", border_radius=10, cartouche_params=cartouches, cartouche_spacing=15) m.add(BasemapLayer()) m.add_shadow(europe, {"query": "code_pays_iso3=='FRA'", "on_cartouches": True}) m.add(VectorLayer(regions, stroke="#9aa6b2", stroke_width=0.4, on_cartouches=True)) m.add(LabelLayer(regions, column="LIB_GEO", font_size=11)) m.title("Regions of mainland France") m.source("Basemap: Natural Earth, IGN ADMIN-EXPRESS") .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.695 seconds) .. _sphx_glr_download_gallery_plot_05_labels.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_05_labels.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_05_labels.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_05_labels.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_