In legend how can you make the polygon symbol which has multiple colors on the map appear with more colors, because in New Print Layout it appears with just 1 color which is not true (Symbology - Geometry generator).

Symbology of the polygon (left - red, right - blue):

enter image description here

Map with Default Legend from Symbology - Geometry Generator:

enter image description here

Map with Edited Legend from Symbology - Geometry Generator in Photoshop:

enter image description here

Is it possible to do something about that or you just have to use Paint / Photoshop to edit that polygon symbol within the legend?

  • How did you create the symbology with two partes (left/right of vertical line): what expression do you use?
    – Babel
    Commented Jan 10, 2023 at 20:27
  • I used no expression in QGIS . I saved the map as PNG , uploaded it in Photoshop , zoomed on the symbol I wanted to edit from the legend , used a ruler from the real world in air not glued to the PC screen to figure out where the half would be then made a square with " Polygonal Lasso Tool " , then copying the color I needed with Eyedropper Tool and finally coloring it with the Brush tool . Maybe you could achieve the same result in Paint . I was wondering if someone could achieve this thing in QGIS without relying on Photoshop or Paint .
    – Zoro
    Commented Jan 10, 2023 at 20:42
  • This is by no way a GIS approach, this is purely a graphical approach. I don't understand why you speak about "Geometry Generator" when you don't need it at all. Please edit and update your question to make clear what you have and where you're stuck.
    – Babel
    Commented Jan 10, 2023 at 20:50
  • As you can see Austria is divided in 2 colors and that was made possible due to coding in Geometry Generator . Problem is Geometry Generator recognises just 1 color and not 2 and in Legend you have just 1 color and I do not know how to edit it .
    – Zoro
    Commented Jan 10, 2023 at 20:57
  • OK, then why don't you provide the code you used in Geometry genrator? That was what I was asking about...
    – Babel
    Commented Jan 10, 2023 at 20:59

1 Answer 1


Instead of using a pixel based graphical software approach, what you want to do can be realized much easier using QGIS expressions with Geoemtry generator. Then also the legend will appear correctly (see screenshot at the bottom).

enter image description here

In addition to the default style (single symbol - yellow, in my case), define a second style of type Geometry generator for the left half (blue, in my case), on top of the yellow style. Use this expression to create such a style:

intersection (
            make_point(x_min($geometry), y_min($geometry)),
            make_point(x_min($geometry), y_max($geometry))

Legend appears correctly: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.