Skip to main content
added 11 characters in body
Source Link
Ecodiv
  • 1.8k
  • 15
  • 16

An old question, but as I couldn't get the plugin mentioned above to work, here another work-around, tested on QGIS 3.12.3. From Ecodiv.earth.

  1. Add a legend with limited number of discrete classes (enough to capture the gradient).
  2. In the composer, add the raster layer and legend.
  3. Under symbol, reduce the height of the symbols (1), deselect the ‘draw stroke for raster symbol’ (2), and under spacing, increase the spacing between symbols (3).

enter image description here

  1. Place a rectangle next to the legend, and select as style gradient fill.
  2. Select the colour ramp, and then the option to edit it.
  3. Now, add as many stops, minus two, as you have colours (1). Place the stops at the right relative distances (2) and use the sample colour function (3, 4) to define the colours.

enter image description here

  1. Now you can move the rectangle on top of the legend symbols to complete it. Group the two together to make it easier to freely move the legend around. More details at Ecodiv.earth

enter image description here

An old question, but as I couldn't get the plugin mentioned above to work, here another work-around, tested on QGIS 3.12.3. From Ecodiv.earth.

  1. Add a legend with limited number of discrete classes (enough to capture the gradient).
  2. In the composer, add the raster layer and legend.
  3. Under symbol, reduce the height of the symbols (1), deselect the ‘draw stroke for raster symbol’ (2), and under spacing, increase the spacing between symbols (3).

enter image description here

  1. Place a rectangle next to the legend, and select as style gradient fill.
  2. Select the colour ramp, and then the option to edit it.
  3. Now, add as many stops, minus two, as you have colours (1). Place the stops at the right relative distances (2) and use the sample colour function (3, 4) to define the colours.

enter image description here

  1. Now you can move the rectangle on top of the legend symbols to complete it. Group the two together to make it easier to freely move the legend around.

enter image description here

An old question, but as I couldn't get the plugin mentioned above to work, here another work-around, tested on QGIS 3.12.3.

  1. Add a legend with limited number of discrete classes (enough to capture the gradient).
  2. In the composer, add the raster layer and legend.
  3. Under symbol, reduce the height of the symbols (1), deselect the ‘draw stroke for raster symbol’ (2), and under spacing, increase the spacing between symbols (3).

enter image description here

  1. Place a rectangle next to the legend, and select as style gradient fill.
  2. Select the colour ramp, and then the option to edit it.
  3. Now, add as many stops, minus two, as you have colours (1). Place the stops at the right relative distances (2) and use the sample colour function (3, 4) to define the colours.

enter image description here

  1. Now you can move the rectangle on top of the legend symbols to complete it. Group the two together to make it easier to freely move the legend around. More details at Ecodiv.earth

enter image description here

Source Link
Ecodiv
  • 1.8k
  • 15
  • 16

An old question, but as I couldn't get the plugin mentioned above to work, here another work-around, tested on QGIS 3.12.3. From Ecodiv.earth.

  1. Add a legend with limited number of discrete classes (enough to capture the gradient).
  2. In the composer, add the raster layer and legend.
  3. Under symbol, reduce the height of the symbols (1), deselect the ‘draw stroke for raster symbol’ (2), and under spacing, increase the spacing between symbols (3).

enter image description here

  1. Place a rectangle next to the legend, and select as style gradient fill.
  2. Select the colour ramp, and then the option to edit it.
  3. Now, add as many stops, minus two, as you have colours (1). Place the stops at the right relative distances (2) and use the sample colour function (3, 4) to define the colours.

enter image description here

  1. Now you can move the rectangle on top of the legend symbols to complete it. Group the two together to make it easier to freely move the legend around.

enter image description here