[GIS] n automatic way to create a diverging colour scale centered around zero

color rampqgisstylethematic map

I'm trying to plot a map of the residuals of a linear model. My residuals centre around zero and can obviously go in either direction.

Is there an easy way to apply a graduated colour scale to these values in QGIS, one that centres on zero and then shades in red above zero and blue below (or whatever colour ramp you choose) without having to manually set the upper and lower limits of each category?

Best Answer

Kludgy method:

Suppose your residuals go from -1 to +2 (use the "Statist" plugin to get the range of your attribute)

Create a dummy point (or other geometry) with residual -2.

Style as normal with an odd number of categories, white in the middle.

Make your dummy point invisible with some other style rule, or maybe delete it (but don't reclassify!). Or put it far away from your data and zoom until it's not visible.

If residuals go from -2 to +1 the dummy point needs value +2.

Related Question