I'm trying to use graduated symbology to show a color ramp for different ranges in the "Percent Ch" variable in my shapefile. When I go to "graduated" in the layer styling panel it shows me that only some of the variables in my attribute table are available from the drop-down menu. "Percent Ch" is listed in the attribute table, but I can't use it for graduated symbology. The only thing I can see that's different with this variable is that it consists of whole numbers with decimals, while the other variables are only whole numbers. Do you know why I can't use graduated symbology here? Do I have to convert the data into a different format? enter image description here

enter image description here


Your numbers in the column Percent_CH are formatted as text, not as numbers (integer, real). You can see that because they are alligned to the left as every other text field like County_Cit. Real numbers like Poplation are alligned to the right.

You can only use numbers as source field for graduated styling, not texts.

You can convert your "string numbers" to actual numbers using the field calculator and creating new fields with the expression to_real("Percent_CH") for decimal numbers or to_int("Total_Popu") for integer data type - replace Percent_CH or Total_Popu with every other fieldname you want to change.

See comment by @MrXsquared (thanks for amendment!): you can also enter to_real("Percent_CH") to the graduated renderer directly. No need for a new field.

  • 3
    you can also enter to_real("Percent_CH") to the graduated renderer directly. No need for a new field. – MrXsquared Dec 2 '20 at 23:30
  • Where do you enter this? I'm not sure what you mean by the graduated renderer. – DanG Dec 3 '20 at 0:03
  • Graduated renderer (symbology) is what you asked for. You enter the expression to the field calculator, see docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/… – Babel Dec 3 '20 at 0:12
  • Or add it directly to the value field in your first screenshot (where you have highlighted shape_area) as proposed by @MrSquared – Babel Dec 3 '20 at 0:15

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.