Is it possible to have the numbers in the raster legend automatically rounded off?

In the example below I'd like the labels to be 8, 29, 51 and so on.

I know I can manually edit the labels, but is it really necessary to do that every time I make a map?


  • Can you select Pretty Breaks in the Mode?
    – Dave C
    Nov 21, 2018 at 14:06
  • I'm not sure what you mean by "the Mode". I haven't seen an option for pretty breaks anywhere in neither properties, style manager, settings, print composer or anywhere else I've tried to find a solution. Nov 21, 2018 at 14:23
  • On your screenshot look under the values, its the next drop down box.
    – Dave C
    Nov 21, 2018 at 14:26
  • Ah, that Mode. Nope, there's only Continuous, Equal interval and Quantile, and neither are very "pretty". Nov 21, 2018 at 14:31
  • "Pretty Breaks" mode is currently only available for vector layers. There's an open feature request to implement it for rasters: issues.qgis.org/issues/15108
    – csk
    Nov 21, 2018 at 16:46

2 Answers 2


As of QGIS 3.16, you can do this directly via the Label precision option under Symbology.

Just set the precision to 0.

You can also use negative numbers to round to powers of 10.

enter image description here

  • Slightly late Tom :-), and not an option when I asked the question, but today it is the correct answer. May 3, 2021 at 21:06

If you have edited them manually, you can copy the style by right clicking on the layer name in your layers panel.

If you added another raster, you can paste the style by also right clicking on the layer name.

enter image description here

If it isn't necessary to have the same intervals in multiple layers, but just integer values in your layer, you can select "Discrete" as Interpolation and "Quantile" as Mode, and then click on the Classify button.

  • Yes, that's true, but that also copies the range of the colorscale, which may be different for the next map (and in my case almost always will be). So if I do that I'll have to change the min/max values, and then the decimals are back again. Nov 21, 2018 at 15:05
  • Did you set the Interpolation to Discrete? Nov 21, 2018 at 15:08
  • No, I'm using linear. I just tried changing to discrete, though; it doesn't change the legend. Nov 21, 2018 at 15:14
  • Sorry, just noticed the last two lines of your reply now. Using discrete as interpolation and then classifying still produces decimal numbers unless (max - min)/<number of intervals> is an integer. Nov 21, 2018 at 15:23
  • 2
    It seems to me that the question was trying to ask for an automated way of rounding the display for a legend. This answer instead addresses transferring styles between rasters. If the answer is that there is no automated way to do this, it would be useful to know that. Nov 12, 2020 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.