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
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.
-
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 withramp_color(ramp_name, the_same_percentage)
as @Al rl suggested, would have been much more efficient.– JoelFeb 5 at 16:01 -
OK, data driven override seems to be the other possibility to do what you want, see edited solution.– BabelFeb 5 at 16:10
-
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 .
-
1
-