Products QGIS Scripts Attribute Histogram Plotter
Attribute Histogram Plotter

QGIS Script · Python

Attribute Histogram Plotter

Plots distribution histograms for any numeric field in a vector layer — auto-detects all numeric columns or targets a specific list. Group by any category field (e.g. tree_type) to get one chart per group, each saved as a PNG and shown on screen. Works great after Tree Height Extractor and Canopy NDVI Calculator to visualise height and NDVI distributions by species.

$20 USD One-time purchase · Instant download
Buy on Gumroad

What you get

plot_attribute_histograms.py
Free updates via Gumroad
Also in the Vegetation & Field Analysis Pack — 6 scripts for $70 · save $50 vs buying separately

What it does

Any numeric field

Set columns = None to auto-detect every numeric field in the layer, or pass a list like ['height', 'NDVI_median'] to target specific fields only.

Grouped by any category

Set group_by to any string field (e.g. tree_type) to generate a separate chart per group — or set it to None to plot all features in one chart.

Side-by-side histograms

One subplot per column arranged in a single row — compare height, NDVI, area, or any other attributes side by side at a glance.

PNG export + on-screen preview

Each chart is saved as {group_value}_distribution.png alongside the source layer file and displayed on screen during the run.

Works great after: Tree Height Extractor + Canopy NDVI Calculator

This script expects a polygon layer that already has height and NDVI_median fields. Run the Tree Height Extractor and the Canopy NDVI Calculator on your polygon layer first, then use this script to plot the distributions.

How to use it

  1. 1

    Click your vector layer to make it the active layer.

  2. 2

    Open Plugins → Python Console → Show Editor.

  3. 3

    Paste the script. At the bottom set columns (None for all numeric fields, or a list like ['height', 'NDVI_median']) and group_by (a category field name, or None for no grouping).

  4. 4

    Click Run. One PNG per group is saved and displayed.

Requirements

  • QGIS 3.28 or newer
  • matplotlib — install via OSGeo4W Shell if not already present: pip install matplotlib
  • Active vector layer with at least one numeric attribute field

Also in the Vegetation & Field Analysis Pack

Get all 6 vegetation scripts for $70 — save $50 vs buying individually.

View bundle