3

As I get more into QGIS scripting, I refer to the documentation often and usually without success. I have trouble deciphering how to interpret the classes, etc.

I've been really struggling to create a New Print Layout and add things to it like the map, legend, label, etc. I have not gotten to trying to make things look nice yet, just the very basic functionality.

Let's take the QgsLayoutItemLegend class for example from the documentation:

Now, I think I understand that in order to create a legend item and add it to my Print Layout, I would do something like this...

QgsLayoutItemLegend.create(legend)

Except, I need to already have a legend item to "create" a legend in the Print Layout. But how do I create this legend item?

I don't only want to know how to create this legend item, but where in the documentation can I even find this?

closed as too broad by PolyGeo Dec 18 '18 at 21:20

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.