4

In QGIS, I have a polygon layer with several text column attributes. I am theming on one, but want the text of another column to show up in the legend. I have successfully populated the text column using the "set labels from Expression..." dialogue from the layer properties legend window as per image1...

enter image description here

But in the actual legend in layout view, the text only shows up as center justified and there is no apparent way to set it to left justify, so that it does not overlap with the symbols (image2).

enter image description here

I've tried changing the text alignment attributes in the layout-legend-Fonts and text panel, but none of the four options there affect the text attribute column independently.

1 Answer 1

5

In the legend tab → Text on Symbol, you need to select the column that holds the lithology symbols, not the description (Lithology), and everything should work correctly:

  • Select label from expression and select the column in the attribute table that holds the symbols (code) of the lithology:

enter image description here

  • The lithology description should be loaded automatically when you style your layer based on the description column.:

enter image description here

  • Here is the output:

enter image description here

  • In the layout view, here is the output:

enter image description here

2
  • Thanks for the clarifications. That definitely works the way I hoped it would. Except that retheming on Lithology instead of Code resets all 250+ colours to new random assortment. I wonder if there is an elegant way to transfer the code-themed colours to the new Lithology-themed layer? Commented Apr 8, 2022 at 16:58
  • @JarrodBrown I am not aware of any way or tool that can help you to transfer the code-themed colors to the new Lithology-themed layer.
    – ahmadhanb
    Commented Apr 11, 2022 at 1:45

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.