0

I am having troubles switching the order of my classifications of my raster, which originates from R language and imported into QGIS. In the attached image I am trying to switch around my grass and forest class, a simple click and drag does not solve the problem. I have also tried switching round the values which does not achieve anything and still leaves the data from the grass and forest in the same order.

Seems like a simple issue but I just cannot fix it.

Class Example

5
  • The order in the color palette is determined by the underlying raster values. Since the class labeled Grass is value 3, and Forest is value 4, then Grass appears before Forest in the list. Can you explain why the order makes a difference?
    – Micha
    Commented Jun 26, 2023 at 18:40
  • Hi, I'm just trying to make the class consistent with my other classification which has grass and forest switched around in my print layout to make it consistent
    – Aaron_Elph
    Commented Jun 27, 2023 at 12:44
  • Are you referring to the order of the items in the Legend? or to the colors used to represent each class?
    – Micha
    Commented Jun 28, 2023 at 17:07
  • Hi, yes the order of the items in the legend, thank you.
    – Aaron_Elph
    Commented Jun 29, 2023 at 7:44
  • Micha`s solution below works, but why not plot in R when it comes from there anyway? Much more flexible.
    – SPet
    Commented Jun 30, 2023 at 17:11

1 Answer 1

1

In the GRASS GUI, when you add a legend for a raster map, in the d.legend window there is a tab "Subset". In that tab you can list the raster values that you want displayed, in any order you want. The legend will then display with the values you entered, in the order you enter. See the image below for an example.

HTH

d.legend example

Your Answer

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

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