4

I made a map with a horizontal legend to show 10 categories in QGIS 2.18.6 (see below), and here comes some questions. Hopefully I can have some suggestions here:

First, I indeed create the legend with 5 columns, but the number of rows is not 2. The right two columns always have three and one categories, respectively. How can I make the legend like a 2X5 matrix?

Second, those color blocks in the legend are arranged vertically. I'd like to have them arranged horizontally; hence, the legend can have all red blocks on the top, and all blue blocks on the bottom. However, I cannot find any setting in the print composer to change the way of arrangement.

enter image description here

1
  • Hmm - that should be fixed in 2.18. Can you put together a project + data which demonstrates this and file an issue on issues.qgis.org//issues?
    – ndawson
    Commented May 16, 2017 at 23:09

1 Answer 1

9

I did see similar odd behaviour (QGIS 2.18.3) - as the number of columns goes up or down, you get jagged vertical columns :/ Odd. Not sure what causes that, but can suggest a work-around.

To force a horizontal legend you can set the number of columns to a high enough value that there is only one category per column. You can then use the various settings (font, spacing etc) to tweak it to your liking.

Here, I randomly assigned each country a value between -10 and +10. I used 21 columns (10 negative, 1 zero and 10 positive) to get a single, horizontal legend,

enter image description here

I also had to edit the subgroup title to change it to empty. Select the subgroup name and click on the pencil icon, and change the name to blank). See below for how to do this... The reason for this is that the subgroup title can cause problems because it appears as an item in its own right, which can mess up the layout.

enter image description here

I think with a diverging colour scheme like this, it's easier to follow on one line (either vertical or horizontal according to your design needs). You could do also two legends, one for negative and one for positive, and remove the categories you don't want from each.

2
  • 1
    This answer is pretty much valid for QGis 3 too. Commented Dec 4, 2019 at 9:04
  • 2
    In QGIS 3, editing the title and changing it to blank doesn't work any more, it displays the original string in that case. What works is right-clicking on the legend item and choosing "Hidden". Commented Jun 3, 2020 at 14:29

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.