I'm sure I've seen a solution to this before but now I can't find it.

When using the graduated fill style in QGIS I get lots of trailing zeros in the labels. This makes my legends look messy in the print composer.

Is there a way to automatically remove these?

Graduated fill style with trailing zeros

  • 1
    There does not seem to be a way to auto change this at least in v2.0
    – artwork21
    Dec 24 '13 at 13:13

Here's the simplest method I've found so far:

  1. Open layer properties
  2. Save style as a QGIS Layer Style File
  3. Open the resulting .qml style file in your favourite text editor
  4. Use find and replace to identify trailing zeros and replace with a zero length string
  5. Apply the altered layer style in QGIS

Note: Be careful when doing the find and replace as the lower & upper values may have a different number of trailing zeros to the label value. If you're not careful you can accidentally increase the values by factors of ten!

  • Note: This has all been sorted in QGIS 2.6
    – Tumbledown
    Nov 21 '14 at 9:28
  • How has it been sorted? :S Edit: I see the "precision" input field in categorized vector layers but not on pseudocolored raster layers, guess there's not an option for the later? :(
    – JorgeGT
    Aug 2 '15 at 12:40

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.