I'm working on Python Console with Qgis vers. 3.36. I would place some labels below some points. I saw just in this forum other question about this issue, but I think the way how to act in this case is changed. Here is the code:
def labelGraph(layerInInput):
labelSet = QgsPalLayerSettings()
text_format = QgsTextFormat()
text_format.setFont(QFont("Arial", 12))
text_format.setSize(10)
labelSet.setFormat(text_format)
labelSet.enabled = True
labelSet.placement = Qgis.LabelPlacement.AroundPoint
etichette = QgsVectorLayerSimpleLabeling(labelSet)
layer_settings = QgsVectorLayerSimpleLabeling(labelSet)
layerInInput.setLabelsEnabled(True)
layerInInput.setLabeling(etichette)
layerInInput.triggerRepaint()
I tried, instead "AroundPoint", also "Horizontal", "OverPoint", "OrderedPositionsAroundPoint", but nothing: the result is not that I wish.