Skip to main content
added 380 characters in body
Source Link

As far as I'm aware, there isn't a neat way to add 'sub-groups' with headings within the legend for layers that have categorised symbology like this. Note - you can group multiple layers and give them sub-headings, but you cannot group multiple symbols within a single layer's style definition.

What you could do as a workaround is add the layer to your legend n times (once per category) and remove the entries which don't belong in that category. You could then rename each layer instance to reflect the relevant category name:

enter image description here

However, I would take a different approach instead. As the symbology is exactly the same, I would be inclined to merge the symbols for all of the unique vegetation types within each category, and label by category (e.g., Forest). You can do this in layer properties

screenshot from layer properties merging symbols

Then, your symbol for "Forest" will only appear once in your legend, rather than being duplicated across all of the forest types.

It seems like your labelling is what differentiates the individual types within vegetation categories (e.g., Forests), so optionally, you could also include a label legend. You can enable label legend in Layer Properties -> Legend. Which will give you a label symbol in your legend within the print layout explaining what the label text means.

Label legend settings

If you really need the legend to look how you have described (i.e., a sub-heading for "Forest" with n number of duplicate symbols with different labels), and you don't like the clunky workaround at the top of my answer, you could generate a layer per category using Split Vector Layer.

split vector layer tool

This depends on having a field which denotes the category in your attribute table. It will return 1 layer per category, so you would have them as individual entries in your attribute table, and you could give them headings as required.

You could package these layers (one per category) into a single Geopackage, so your dataset would still be on the disk as one file, but each vegetation class would be a separate layer and you'd have more flexibility in setting out your legend.

As far as I'm aware, there isn't a way to add 'sub-groups' with headings within the legend for layers that have categorised symbology like this.

As the symbology is exactly the same, I would be inclined to merge the symbols for all of the unique vegetation types within each category, and label by category (e.g., Forest). You can do this in layer properties

screenshot from layer properties merging symbols

Then, your symbol for "Forest" will only appear once in your legend, rather than being duplicated across all of the forest types.

It seems like your labelling is what differentiates the individual types within vegetation categories (e.g., Forests), so optionally, you could also include a label legend. You can enable label legend in Layer Properties -> Legend. Which will give you a label symbol in your legend within the print layout explaining what the label text means.

Label legend settings

If you really need the legend to look how you have described (i.e., a sub-heading for "Forest" with n number of duplicate symbols with different labels), you could generate a layer per category using Split Vector Layer.

split vector layer tool

This depends on having a field which denotes the category in your attribute table. It will return 1 layer per category, so you would have them as individual entries in your attribute table, and you could give them headings as required.

You could package these layers (one per category) into a single Geopackage, so your dataset would still be on the disk as one file, but each vegetation class would be a separate layer and you'd have more flexibility in setting out your legend.

As far as I'm aware, there isn't a neat way to add 'sub-groups' with headings within the legend for layers that have categorised symbology like this. Note - you can group multiple layers and give them sub-headings, but you cannot group multiple symbols within a single layer's style definition.

What you could do as a workaround is add the layer to your legend n times (once per category) and remove the entries which don't belong in that category. You could then rename each layer instance to reflect the relevant category name:

enter image description here

However, I would take a different approach instead. As the symbology is exactly the same, I would be inclined to merge the symbols for all of the unique vegetation types within each category, and label by category (e.g., Forest). You can do this in layer properties

screenshot from layer properties merging symbols

Then, your symbol for "Forest" will only appear once in your legend, rather than being duplicated across all of the forest types.

It seems like your labelling is what differentiates the individual types within vegetation categories (e.g., Forests), so optionally, you could also include a label legend. You can enable label legend in Layer Properties -> Legend. Which will give you a label symbol in your legend within the print layout explaining what the label text means.

Label legend settings

If you really need the legend to look how you have described (i.e., a sub-heading for "Forest" with n number of duplicate symbols with different labels), and you don't like the clunky workaround at the top of my answer, you could generate a layer per category using Split Vector Layer.

split vector layer tool

This depends on having a field which denotes the category in your attribute table. It will return 1 layer per category, so you would have them as individual entries in your attribute table, and you could give them headings as required.

You could package these layers (one per category) into a single Geopackage, so your dataset would still be on the disk as one file, but each vegetation class would be a separate layer and you'd have more flexibility in setting out your legend.

Source Link

As far as I'm aware, there isn't a way to add 'sub-groups' with headings within the legend for layers that have categorised symbology like this.

As the symbology is exactly the same, I would be inclined to merge the symbols for all of the unique vegetation types within each category, and label by category (e.g., Forest). You can do this in layer properties

screenshot from layer properties merging symbols

Then, your symbol for "Forest" will only appear once in your legend, rather than being duplicated across all of the forest types.

It seems like your labelling is what differentiates the individual types within vegetation categories (e.g., Forests), so optionally, you could also include a label legend. You can enable label legend in Layer Properties -> Legend. Which will give you a label symbol in your legend within the print layout explaining what the label text means.

Label legend settings

If you really need the legend to look how you have described (i.e., a sub-heading for "Forest" with n number of duplicate symbols with different labels), you could generate a layer per category using Split Vector Layer.

split vector layer tool

This depends on having a field which denotes the category in your attribute table. It will return 1 layer per category, so you would have them as individual entries in your attribute table, and you could give them headings as required.

You could package these layers (one per category) into a single Geopackage, so your dataset would still be on the disk as one file, but each vegetation class would be a separate layer and you'd have more flexibility in setting out your legend.