3

I am making a choropleth map to show the value, for each polygon, of an ordered categorical variable (a decile, in fact). So, each polygon already has a specific singular value of this variable, between 1 and 10. There are no missing or NA values. I am using an ordered palette (viridis).

When I use "Classify" within the Symbology tab, I get 11 categories, because QGIS appends an "All other values" (AOV) category. This category is allocated the far end of the viridis palette (yellow), and all other palette colours within the ramp are slightly shifted accordingly (as the palette is split into 11 rather than just 10). For consistency with other maps, I would like my 10 categories to be allocated evenly along the viridis palette. I do not want to have an "All other values" category - it has no use for me as I don't have any other values not already included in the range 1-10, or any missing values.

In order to get the proper 10-step colour ramp (for consistency with other maps), I have been deleting the AOV category and then manually amending all the other colour values to what they would have been if the palette had been divided up into 10 originally. This is time-consuming and frustrating.

  • Is there a way to prevent QGIS from appending the AOV category?
  • Or, is there a way to get QGIS to allocate a 10-split viridis colour ramp to my values 1-10 and to allocate an entirely different shade (say, grey) to the AOV category, so I could simply delete it without affecting the rest of the ramp?

If I make my map with the tmap package in R, I do not get this issue.

For those thinking I should use the original data and use the Graduated tab and create my own deciles from that, imagine that all I have is the already-calculated decile number for each area. While the source data would have been a continuous variable, once it is converted into quantiles, it becomes ordered categorical (or factor) data - unless I am mistaken? (A polygon is either in decile 5 or 6, say, it's not 5.78)

5

You just have to delete the AOV category then select again your color ramp. This will reatribute the color evenly on all remaining classes (if you want to keep the AOV category with a color not in your color ramp, like grey, you have to add again the AOV category and give it a color)

1
  • That solves the brunt of my issue - thank you. I did know that you could just click on the ramp to re-apply, I used that recently, but for some reason I did not think to do that in this situation. It doesn't completely solve the issue of the allocation of AOV where there aren't any other values in the dataset for the variable in question, but it will certainly save me the main headache! Thanks. – Francis Barton Jan 27 at 17:52
1

I created a buffer layer with random integer values from 1 to 10: that corresponds to what you have, right? You can use this with graduated rendering style / equal interval / 10 categories. However, to use the whole color ramp (0% to 100%), the smallest value (1) should be 0, the highest one, 10, can stay like this. To achieve this, I use the formula ("value"-1)/9*10 as input value.

Screenshot: the values for each polygon are added as label to see how it corresponds to the color ramp:

enter image description here

2
  • That looks very clever - thank you. It's a bit more complicated than I need though - and still uses a graduated approach rather than categorical. – Francis Barton Jan 27 at 17:50
  • 1
    Indeed: @J.R 's solution is much better and more elegant :-) – Babel Jan 27 at 18:00

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.