Skip to content

r.histogram: an addon to draw a histogram based on raster values - #1904

Merged
ecodiv merged 3 commits into
OSGeo:grass8from
ecodiv:r_histogram
Nov 15, 2026
Merged

ecodiv merged 3 commits into
OSGeo:grass8from
ecodiv:r_histogram

Conversation

@ecodiv

@ecodiv ecodiv commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Addon draws a histogram of the non-NULL values in an input raster map. It exposes various matplotlib options to set bar colors (including colors based on raster color table), line width, axis labels. It complements d.histogram by allowing the user to create more print ready images, and v.histogram, which creates histograms based on attribute values of a vector layer.

Addon draws a histogram of the non-NULL values in an input raster map.  It exposes various matplotlib options to set bar colors (including colors based on raster color table), line width, axis labels.  It complements d.histogram by allowing the user to create more print ready images, and v.histogram, which creates histograms based on attribute values of a vector layer.
@ecodiv ecodiv self-assigned this Nov 7, 2026
@ecodiv ecodiv added the new addon PR contains a new addon or issue proposes one label Nov 7, 2026
Comment thread src/raster/r.histogram/r.histogram.md Resolved
correct lint error and more robust determination if region and raster extent/resolution match.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unquoted raster name in the temporary-copy mapcalc expression can cause valid inputs to fail or silently plot incorrect values.

4 open issues
What changed in this PR

Adds r.histogram, a GRASS addon for creating customizable, print-ready histograms from raster values, complementing d.histogram and v.histogram.

Changes:

  • Computes equal-width histogram bins with r.stats, supporting cell counts and percentages.
  • Adds Matplotlib display and image export with raster-based colors, horizontal orientation, and formatting options.
  • Provides usage examples and build definitions for Make and CMake.
File Description
src/​raster/​r.histogram/​r.histogram.py Implements histogram computation, styling, and output.
src/​raster/​r.histogram/​r.histogram.md Documents options, behavior, and examples.
src/​raster/​r.histogram/​r.histogram.html Provides the HTML manual and illustrated examples.
src/​raster/​r.histogram/​Makefile Adds the script’s Make build target.
src/​raster/​r.histogram/​CMakeLists.txt Defines CMake addon installation and documentation files.

Review effort: Balanced

Comment thread src/raster/r.histogram/r.histogram.py Resolved
Comment thread src/raster/r.histogram/CMakeLists.txt Resolved
Comment thread src/raster/r.histogram/r.histogram.py Resolved
Comment thread src/raster/r.histogram/r.histogram.py Resolved
Fix string formatting in mapcalc and update documentation for raster mask functionality. Add additional documentation files for histogram.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ecodiv
ecodiv merged commit 989d36f into OSGeo:grass8 Nov 15, 2026
8 checks passed
@ecodiv
ecodiv deleted the r_histogram branch November 15, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new addon PR contains a new addon or issue proposes one

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants