3

I have a vector layer with values ranging between 0 and 1 in the field I want to plot. I choose Graduated symbology type and a colour ramp. But then it seems to me like you have to divide your values into classes. I can choose Pretty Breaks and type in a high number of classes, like 100, and it all works out, but it seems like an inefficient way to do it. Am I doing it wrong? Is there no option to let QGIS associate each value with a hue along the colour ramp continuously? E.g. if the value of a feature is 0.387 it should be coloured with the hue lying at 38.7% the length of the colour ramp.

2 Answers 2

4

Set Mode to Equal Interval, than you get what you want (this also works for the legend):


Another option if you want to avoid creating categories (like when using Graduated symbology), but instead want the color to be selected continuously from a colour ramp, is to set the color to data driven override and select Assistant.

In the Assistant, select the source (an attribute field or expression), load Values from / to and select a color ramp.

enter image description here

enter image description here

3
  • Yes, this basically does the same as Pretty Breaks, and it does work for sure. I was just thinking that it seems a bit excessive, even with as many as 100 classes you only get accuracy by integer percent. A continuous scale without classes, correlating the exact percentage with ramp_color(ramp_name, the_same_percentage) as @Al rl suggested, would have been much more efficient.
    – Joel
    Feb 5 at 16:01
  • OK, data driven override seems to be the other possibility to do what you want, see edited solution.
    – Babel
    Feb 5 at 16:10
  • That's the thing! Thank you!
    – Joel
    Feb 5 at 16:28
0

There could be a way to get a more gradual rendering but you wouldn't be able to use the legend symbols directly. You'd probably need to make a mock ramp (an expty raster with the symbology to populate the legend).

As for the vector layer itself, using data-defined symbology you can use the ramp-color function to get the color value, just need to use the name of the ramp you want and scale the values them between 0 and 1 .

2
  • 1
    What do you mean by data-defined symbology? How do I use that?
    – Joel
    Feb 5 at 16:03
  • Alright, @Babel got there first and sorted it all out :)
    – Joel
    Feb 5 at 16:31

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.