Skip to content

Instantly share code, notes, and snippets.

View malbles's full-sized avatar
🗺️
Map making

Malik Blesius malbles

🗺️
Map making
  • Trier, Germany
  • 19:12 (UTC +02:00)
View GitHub Profile
@malbles
malbles / pyqgis_legend_spacing.py
Created May 20, 2026 10:40
Python for Legends (QGIS)
# Set legend spacing through python console in QGIS
layout_name = "my_layout"
legend_name = "my_legend"
# Get the layout from the layout manager and the legend item by id
layout = QgsProject.instance().layoutManager().layoutByName(layout_name)
legend_item = layout.itemById(legend_name)
# Specify spacing
# space below legend title