2

QGIS automatically generates legends for single band rasters in the print composer legend window.

In the latest releases, it appears that the legend automatically creates a "Band" title in the legend as seen in the figure below.

Sample Legend

I find this unnecessary as the vast majority of the raster data that I deal with is single band and I dont wish to manually turn remove the band in the legend item everytime. My audience is not aware of raster bands and hence I dont wish to add this in the legend.

I am looking for the following output:

enter image description here

Is there a setting somewhere where I can turn off this behaviour for single band rasters? I could not locate it. Perhaps a default variable that can be editted?

2
  • I can't replicate this issue. What version of QGIS are you using and what raster data format? – Ed Rollason Mar 19 at 9:19
  • Occurs consistently on 3.18.1 across all single band rasters – itsgupta Mar 27 at 1:26
0

Just stumbled on this problem myself... Found a (slightly hacky) solution.

Double click on the text that says "Band 1" in the Legend Items box of the layout. replace this text with a space i.e. " ".

Then, open the Spacing tab and reduce the "space between symbols" value to remove the gap created by the Band description.

Hugh

Edit: I should add that I did this using the new continuous colour palette, I suspect it won't work quite as well using the discrete palette as in your example...

EDIT: following the comment from @itsgupta, they suggest a better solution which is to click on the offending 'Band 1' text and then hit the red minus button ('reomve selected items') to delete it.

5
  • Hugh, what QGIS version? What do you mean by "...the new continuous colour palette..."? Is there an old palette? Please edit your answer with screenshots. – Stu Smith Mar 26 at 16:31
  • @hugh-graham Good solution. You can also click the "band 1" text in the legend and hit the red minus button to remove it. The problem is that there are lots of rasters in some atlas mapping and doing this process manually is tiresome. This is a new and unwelcome change in QGIS which I dont believe you can turn off by default. I am hoping there is a setting hidden somewhere or maybe it can be implemented/reverted in a future release. – itsgupta Mar 27 at 1:29
  • @StuSmith There is a new continuous legend style for linear rasters. Previously they were discrete boxes in the legend. This issue is on QGIS 3.18 and higher. – itsgupta Mar 27 at 1:31
  • Sorry for the delayed response. Thank you @itsgupta for directing me to the red minus sign solution - this is much better IMO and will work better with multiple layers etc. I'll add this to my awnser to increase its visibility. – Hugh Graham Mar 30 at 10:04
  • @StuSmith I think itsgupta has answered these questions as well as I can. Happy to provide screen shots if this still isn't clear. If you go into layer properties for your raster > symbology > legend settings > check 'use continuous legend' box. This displays the colour palette as continuous in the legend of your layout. – Hugh Graham Mar 30 at 10:11
0

To expand on what Hugh Graham and itsgupta have reported, I was initially unable to double-click on the 'Band 1' text; the icons below were also greyed out.

I solved my problem by unchecking the Auto-update button in the Layout's legend properties:

Before:

enter image description here

After:

enter image description here

Unchecking the Auto-update button allowed me to double-clck the 'Band 1' text, and it also exposed the red-colored minus button, allowing me to complete the steps described by Hugh and isgupta.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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