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 '18 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. – Thomas Ljungberg Nov 21 '18 at 14:23
  • On your screenshot look under the values, its the next drop down box. – Dave C Nov 21 '18 at 14:26
  • Ah, that Mode. Nope, there's only Continuous, Equal interval and Quantile, and neither are very "pretty". – Thomas Ljungberg Nov 21 '18 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 '18 at 16:46

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. – Thomas Ljungberg Nov 21 '18 at 15:05
  • Did you set the Interpolation to Discrete? – Michel Stuyts Nov 21 '18 at 15:08
  • No, I'm using linear. I just tried changing to discrete, though; it doesn't change the legend. – Thomas Ljungberg Nov 21 '18 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. – Thomas Ljungberg Nov 21 '18 at 15:23
  • I edited my answer. If I combine Discrete with Quantile I always get integers. – Michel Stuyts Nov 22 '18 at 11:12

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.