A scatterplot of two rasters in QGIS

qgis
data visualisation
model designer
open-source
osgeo
Use this model in QGIS model designer to quickly compare two raster layers by visualizing their values in a scatter plot.
Author

Paulo van Breugel

Published

March 22, 2025

Description

The QGIS graphical modeler makes it straightforward to link together different operations and algorithms from the toolbox, allowing you to build custom models for a variety of spatial tasks. One practical example is creating a model to compare two raster layers by displaying their values in a scatter plot.

I developed this function while teaching a course on spatial multi-criteria decision analysis (MCDA)—part of the second-year Naturally Geographic program at the HAS green academy. In MCDA, we often need to compare indicators, such as the distance to a wind turbine versus the cost of the land. Because each indicator may have different units, it’s helpful to normalize them onto a common scale (e.g., 0–1 or 0–100). In QGIS, you can do this easily using the Fuzzify functions.

Once layers are rescaled, I like to compare the original and transformed versions in a scatter plot. While there isn’t a built-in tool specifically for this, you can simply create a point layer, extract each raster’s values at those points, and use the Vector layer scatterplot function for visualization. Although this manual approach is straightforward, I wanted to automate the intermediate steps. Hence the custom model, presented below.

Example

Use the Create random raster layer algorithm to generate a raster with random values (e.g., between 0 and 100) in a specified extent and cell size.

Run the Fuzzify raster (Gaussian membership) function on the random raster. This will produce a new layer with values between 0 and 1, based on a Gaussian fuzzy membership curve.

Grab the model from GitHub and open it in QGIS. Provide your two rasters as inputs (e.g., the original random raster and its fuzzified version).

After running the model, an HTML file (e.g., random_gaussian.html) will be generated, displaying a scatter plot. The X-axis shows the original raster values (0–100), while the Y-axis shows the corresponding fuzzified values (0–1). You’ll notice a smooth, Gaussian-like shape that illustrates the relationship between the original and transformed raster layers.

A simple solution if you want to quickly compare the values of two raster layers :-).