I am trying to port some code from an older version of QGIS. I have managed to get the map setup fairly to my liking, and can export some content via a command like
However, I want to export to PDF, and also add a legend for my graduated color scale. I've been rummaging around the documentation online for some time but I can't figure out how these new classes work together.
@JoshC helped me to understand that I need to use the QgsLayout and QgsLayoutExporter classes, not mapCanvas, however I'm not clear on how to use those classes to get out a PDF with a legend.