9

I have a polygon layer which has a number attribute and a text attribute. When I make a legend in the composer, it automatically chooses the number to display while I would like to have both the number and the text.

How do I display two attributes in a legend? If not possible, how do I select which attribute is displayed in the legend?

Sample of the attribute table

I am not looking to have a multi-attribute label in the main window, I wish to have a multi-attribute label in the legend of the composer, or choose which attribute is displayed in the legend.

QGIS 2.8 Win8 64 bit.

2
  • 1
    I've reopened this question since it's sufficiently different from suggested related questions. As was pointed out in a comment, there is a functionality like this in ArcGIS which allows to add legend labels and descriptions.
    – underdark
    May 15, 2015 at 19:24
  • 1
    Thanks for the above. The concatenation expressions work well. Problem is, I then lose my style as You need to recategorize after doing the concatenation. Is there a way of applying the old style to the new concatenated field?
    – Mongrel
    Aug 5, 2021 at 4:41

2 Answers 2

5

You could simply concatenate the three classification fields in the layer's properties.

 "Unit_Num"  || ' ' ||  "Age"  || ' ' ||  "Name" 

Layer properties

Then it will also appear in the legend in the Print composer:

Legend in Print composer

Unfortunately, the concatenated text will also appear in the main window.

Edit: The legend is derived from your classification, but you can of course label your features with another field:

Labeling

1
  • 2
    If what you want is to label your features with another field than the symbology, it's perfectly feasible as they are set independently in the layer's properties. I've edited the answer to add a screenshot.
    – thibautg
    May 15, 2015 at 7:45
2

The legend can only display the classification set up in the layer's properties. (Afaik, there is currently no equivalent to ArcGIS's legend label descriptions.)

One workaround would be to edit the legend manually in the Print Composer which is probably not an option.

The better option is to set up a classification which will result in the desired legend output as Thibautg has illustrated.

3
  • I have added a sample screenshot of the attribute table. The layer is a geology map consisting of polygons that have a unit number and a description. I want to display the number and the description
    – Gin
    May 14, 2015 at 17:55
  • So I take it there's no analog in QGIS to the label descriptions in ArcGIS's legend tool? For those not familiar it isn't shown/described very well in the help but is mentioned and sort of shown about 3/4 of the way down the page.
    – Chris W
    May 14, 2015 at 22:17
  • @ChrisW That's right! There is currently no equivalent to ArcGIS's legend label descriptions, afaik.
    – underdark
    May 15, 2015 at 11:58

Your Answer

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

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