# Is there any way of making label size dependant from the value of an attribute?

I know QGIS has a feature to make labels size dependant from an attribute:

The problem is that I don't know how to choose a maximum size or even a size variation-scale. It makes the size proportional to the values of the chosen attribute, which sometimes makes the lables too big (or too little):

I've tried to use the "expression" labeling (for example using logarithms), but I don't know how to make the maximum and minimum be less "extreme".

Is there a way (maybe through an expression) to make the size of the labels more visual-friendly? Something to make those labels "less proportional" to the attribute.

• I posted an answer similar to this: gis.stackexchange.com/questions/210677/… – DPSSpatial Oct 3 '16 at 14:34
• Thanks for your interest. The problem is that the attribute is independent from the geometry. And the minimum and maximum values of the attribute are too far one from the other to simply multiply by some factor . Min=0,1, max=15,1 so if I multiply this number by any real number, the difference will still be the same. – Andreu Amoros Oct 3 '16 at 14:39

## 1 Answer

I think i've found a solution trying random functions and expressions. There is a function called "scale_linear" that allows to make a linear dependency.

I put the field name in the "input domain" and define a domain-range between the minimum and maximum value of my attribute (in my case 0.1% and 15.1%) then I put the output range (label size) I want as a minimum and maximum (in my example 5mm and 8mm).

So this is what happens:

The function assigns a size of x[5; 8] to an attribute y[0; 15], in a linear way. So:

0 % = 5 mm

15 % = 8 mm

And the result is:

• Looks good! I'll share this on the thread I linked to... – DPSSpatial Oct 3 '16 at 15:05