Hot answers tagged

70 votes

Using continuous color band for raster legend in QGIS composer legend?

Update: QGIS 3.18 now has built in support for gradient color band legend items, so the previous workarounds are no longer necessary! For earlier versions: Another option is to add a rectangle shape ...
user avatar
  • 26.2k
57 votes
Accepted

Getting legend label on multiple lines in QGIS?

In QGIS 2.8 Composer, there's a Wrap text on option in the Item properties tab when you add a legend which lets you enter a character where you want the new line to start. What I normally do is use ...
user avatar
  • 72.2k
24 votes

Adding layer to group using PyQGIS

[Updated to QGIS v3.x] With the new layer list widget (aka legend, ToC or layer tree) added by Martin Dobias since QGIS v.2.4, you can follow this procedure from the QGIS Python console in order to ...
user avatar
18 votes
Accepted

Using continuous color band for raster legend in QGIS composer legend?

A bit of a hack round to get composer to do this in QGIS 3 Add your legend, then adjust the symbol size in your legend to something small (example is 1.5mm). You'll still see white lines dividing ...
user avatar
  • 1,402
18 votes

How to remove layer names from the print composer legend?

Uncheck the "auto update" box. This makes it possible to remove fields from the Print Composer without removing them from the project. You can't remove a parent without removing the children. However,...
user avatar
  • 371
17 votes

Label legend interval with number of elements in ArcMap?

In layout view, open the legend properties and browse to the Items tab (see above picture) where you can specify which items show the count. If you were asking specifically about showing the count in ...
user avatar
  • 3,033
16 votes
Accepted

Can someone help me identify this part of the map?

Here you find the map including the legend. The legend is in German, but I am German, so I tried to translate it as precise as possible. I think (and please @Giancarlo correct me, if you disagree): ...
user avatar
  • 874
15 votes
Accepted

Displaying attributes upon their polygons within ArcMap legend?

I have managed this earlier by following this workflow: Double-click the Legend in the Layout. Legend Properties > Items tab. Select the layer in the list and click the Style button. Click the ...
user avatar
14 votes

Subscript labels in QGIS legends

Dealing recently with this issue I have found very helpful website Tiny Text Generator - you simply write there number/text and it translates it to small caps, superscript and subscript. You can ...
user avatar
  • 9,216
13 votes

Using continuous color band for raster legend in QGIS composer legend?

A workaround without pictures is to add the gradient using a HTML frame and some CSS magic: <html> <head> <style type="text/css"> body { background: -webkit-linear-gradient(left,...
user avatar
  • 81.9k
13 votes
Accepted

How to remove selected elements from a QGIS legend?

Instead of deleting legend items, you could hide them. From the Legend items options window, right-click the name of the layer and select the Hidden option: This would hide the names of layers, ...
user avatar
  • 72.2k
13 votes

Subscript labels in QGIS legends

You can still use the character map to get subscript numbers in legend, as you can see below: However, subscripts are supported only in some fonts. You can refer to this link to know which fonts ...
user avatar
  • 36.2k
12 votes
Accepted

Manually classifying graduated data outside of range in ArcGIS for Desktop?

It's definitely a major pain when ArcMap tries to be, um, helpful even when you really don't want it to be. One workaround I've found is to create a new temporary dataset, and add a few points with ...
user avatar
  • 20.5k
12 votes

Displaying legend item as polyline instead of polygon in ArcMap?

Decrease the height of the the legend box to zero: In the example below you can see that I got a line legend even if my data is polygon. Right-click on your legend, click on properties Go to the ...
user avatar
  • 2,156
12 votes
Accepted

Making legend items start in new column in ArcGIS Pro?

Using ArcGIS Pro 2.3.0, youu can select 'Legend Arrangement Options': Select 'Adjust Frame'.: Then select the item from the legend that will go in a new column and return to the 'Element' settings, ...
user avatar
  • 146
12 votes

How to add text on top of symbols for vector layers in QGIS

Right-click the the target layer -> Properties -> Legend and click on Set Labels from expression: In expression you can write whatever you want, for example: substr( "FieldName",4,1) ...
user avatar
  • 36.2k
11 votes
Accepted

What's the QGIS Legend Format Syntax to label percentage values?

You can multiply the value by 100 in the column definition and then add the % signs in the legend format as shown here:
user avatar
  • 81.9k
11 votes
Accepted

Adding Leaflet legend?

I found the problem. The code that I posted in the question above was correct but I had made a schoolboy error in the css part. I am pretty new to leaflet and coding in general and there is very ...
user avatar
11 votes
Accepted

How to create a continuous scale with distinct/custom color and value breaks with ggplot2 map

You just need to cut the data first: library(rgeos) library(maptools) library(raster) library(ggplot2) library(dplyr) library(ggthemes) library(ggalt) library(scales) #load shapefile ken <- ...
user avatar
  • 1,164
11 votes

Feature Count in Legend (QGIS 2.18.2)

You may try a right click on your layer and then chose to Show Feature Count (green on figure):
user avatar
  • 6,698
11 votes

Why are size-scaled symbols missing from map layout legend?

I am able to reproduce your error using QGIS 3.2.0, but it works when using QGIS 2.18.21. There are also already a couple of bug reports regarding the size assistant, with this one being probably the ...
user avatar
  • 2,271
11 votes

Make legend in QGIS only show features in the view extent?

You can use the "Filter legend by map content" button in the print composer item properties for your legend item. The print composer legend will then only show the layers which are within your ...
user avatar
  • 13.6k
11 votes
Accepted

Modifying layer name in the layout legend with PyQGIS 3

You must set setUseLayerName() to False to name legend tree layers manually. # # previous lines # for i, layer in enumerate(layersToAdd): tree_layer = root.addLayer(layer) tree_layer....
user avatar
10 votes
Accepted

Changing Legend Size with PyQGIS

As you guessed it's impossible to make the legend smaller then its contents. So, to change the legend font size, use something like: newFont = QFont("Comic Sans MS", 6) cleg.setStyleFont(...
user avatar
  • 26.2k
10 votes

Displaying legend item as polyline instead of polygon in ArcMap?

The workaround I usually use for any situation in which I want to customize the legend entry for a layer is to create a dummy layer which is only used in the legend, and not displayed on the map. So ...
user avatar
  • 12k
10 votes

QGIS: Legend with more columns in one row

In the QGIS map composer, under Legend Items, you can specify the number of columns that you want in your legend e.g.: Which will produce:
user avatar
  • 4,752
10 votes
Accepted

Group legend in ArcMap basing on field value

Here is one solution on top my head: Create a new string field and use field calculator to compute as the concatenation of other fields. Here is the python snippet: !abbrev! + ' ' + !fullname1! +'...
user avatar
10 votes

How to only display active layers in legend?

Use the "Filter Legend by map Content" button. The legend updates and only in the map visible layers are present in the legend (referring to QGIS Version 2.18.6).
user avatar
  • 101
10 votes
Accepted

How to change legend orientation in QGIS?

I don't think this is currently possible as there is already an existing ticket which was updated a year ago: http://hub.qgis.org/issues/3239
user avatar
  • 72.2k
10 votes

Is it possible to change legend symbols in the QGIS print composer legend?

Since this topic covers a lot of arguments, I will only focus on the SVG symbol layers, hoping that I have understood well what are you looking for (I didn't realize the length of the answer while ...
user avatar
  • 15.5k

Only top scored, non community-wiki answers of a minimum length are eligible