9

In QGIS 3.18 (and older versions) I noticed that the first item in a multi-column legend isn't aligned with the items in other columns. I have played with the settings in the Spacing column but can't find a way to fix it. They are all defined as Subgroups but have also tried to define the Title as a group (menu on right click when in the legend definition view)

enter image description here

enter image description here

Related to this, I've found some icons aren't aligned. There is no xy offset set on it

enter image description here

The only way I can see to fix it is by splitting the legend into columns. Is there an easier way?

UPDATE based on answer from Corentin Lemaitre

Issue 2 (Horizontal) is fixed by changing the patch size. But I can't fix issue 1 (Vertical) alignment using spacing...

enter image description here

If I reset everything to Default, we still have the issue.

enter image description here

Then with layer title Hidden

enter image description here

And with it set as Subgroup

enter image description here

In all cases you will see the text is out of vertical alignment in the first column but in the 2 and 3rd columns it is fine eventhough they are point and polygon respectively. Column 1 and 2 are point symbology.

2
  • On the two last you could get horizontal alignment. For case "with title layer hidden" your airport symbol is bigger than your symbol cell so it is moving your text linked to it down. You have to get symbols 0 airport and Populated place with same size (get the first smaller or the size of your symbol cell bigger). For case with setup as subgroup you have to use a subgroup as first item of your second column (and third column too) you could create one just for rendering. Commented May 13, 2021 at 10:32
  • Thanks -in the end I just split the legend into 2 items so I could move the items as required as the process of adding layers just for rendering was more complex.
    – GeorgeC
    Commented May 13, 2021 at 22:27

1 Answer 1

5

You describe two problems :

The vertical alignment. The first item of a column could be aligned with the first item of other column if it is same type : symbol would be aligned with symbol and title for group and sub-group could be aligned together. If you use no spacing and the same font you can see that item text and title text have different padding. enter image description here

The solution you could choose to have only symbol at the begining of the column or only title. You can hide or show title and edit any item in your legend to set it to : Start a new column before this item.

On my first post I have understand you talk about horizontal alignmement, here is the solution to align subgroup or group title with symbol legend. In QGIS title are by default aligned with the right border of the column they are in. There is different solution to get what you want :

  1. Easy solution that will change the style of your legend. In Main properties > Arrangement choose symbols on the right.
  2. Solution that will do really what you want. In spacing go to Group Heading > Side of heading and set it to 9 mm or more to align it with the item title. Do the same for Subgroup Heading > Side of heading. The value to be align have to be equal to Symbol width (in Symbol) + Symbol label space (in Spacing). enter image description here

For your second problem this appends when your symbol real width in the styling option of your layer is greater than your symbol size set in the legend in symbol. Different solutions :

  1. Modify the symbol width in Symbol Symbol width to be greater than your real symbol.
  2. In Symbol set a symbol max size to reduce the size of the symbol used for representation in the legend.
  3. Modify the symbol show in the legend to be sure it is centred. In Legend item select the item you want to modify then click edit button then you can choose to set width and height to be different than your default value OR to select Custom symbol and adapt your symbol shown in the legend to be sure it matches what you want.

enter image description here

1
  • 1
    Thanks. I've changed the title to be 'Vertical and Horizontal...' to cover both issues. Resetting the patch size fixes the horizontal issue as you have described. I have tried the settings you suggested for the vertical alignment but it doesn't fix the problem. I will add an updated screenshot. Right alignment of the icons doesn't look nice and also doesn't fix the issue.
    – GeorgeC
    Commented May 12, 2021 at 21:04

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.