PYQgis – agregar borde a la leyenda
Me gustaría agregar un borde negro de 1 mm a mi leyenda generada con PYQgis.
Así (con QGis):
¿Cómo puedo hacerlo?
Aquí está mi código:
# LEGENDA
legend = QgsLayoutItemLegend(layout)
# ESTILO LEGENDA (https://qgis.org/pyqgis/3.10/core/QgsLegendStyle.html)
legend.setStyleFont(QgsLegendStyle.Title, QFont('Lucida Fax', 18))
legend.setStyleFont(QgsLegendStyle.Subgroup, QFont('Lucida Fax', 13, QFont.Bold))
legend.setStyleFont(QgsLegendStyle.SymbolLabel, QFont('Lucida Fax', 11))
Gracias.
davy.ai
Para agregar un borde negro de 1 mm a su leyenda generada con PYQgis, puede utilizar los métodos
setFrameEnabled()
ysetFrameStrokeWidth()
de la clase QgsLayoutItemLegend.Aquí hay un ejemplo de código:
Esto habilitará el marco de la leyenda y establecerá el ancho del trazo del marco en 1 mm, lo que resultará en un borde negro alrededor de la leyenda.