Skip to content

Choropleth plotting - #429

Merged
clorton merged 5 commits into
mainfrom
choropleth-plotting
Jul 15, 2026
Merged

Choropleth plotting#429
clorton merged 5 commits into
mainfrom
choropleth-plotting

Conversation

@clorton

@clorton clorton commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #201

clorton added 2 commits July 8, 2026 11:26
Add a reusable `choropleth()` function for rendering spatial maps of
per-region quantities from GeoDataFrames or custom value arrays.
Includes
comprehensive test coverage and a Jupyter notebook demonstrating both
single and multi-panel usage patterns.
No additional project dependencies.
ffmpeg use optional for .mp4 output.
@clorton clorton added this to the M3: LASER 1.1 milestone Jul 8, 2026
@clorton
clorton requested a review from Copilot July 8, 2026 19:26
@clorton clorton self-assigned this Jul 8, 2026
@clorton clorton added the enhancement New feature or request label Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds reusable choropleth plotting utilities to laser.core (static and animated) and introduces a dedicated test suite plus changelog documentation for the new functionality.

Changes:

  • Add laser.core.plotting.choropleth() for static choropleth rendering with optional log scaling and optional fixed color scale (vmin/vmax).
  • Add laser.core.plotting.animate_choropleth() + _save_animation() to render a sequence of frames with a shared color scale and multiple output formats (GIF/HTML/ffmpeg-backed video).
  • Add comprehensive tests for both helpers and document the feature in CHANGELOG.rst.

Reviewed changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated 5 comments.

File Description
src/laser/core/plotting.py New choropleth + animated choropleth helpers (plus writer-selection save helper).
tests/test_plotting.py New tests validating static/animated choropleths, IO paths, and error handling.
CHANGELOG.rst Documents the new plotting capabilities in the Unreleased section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_plotting.py Outdated
Comment thread tests/test_plotting.py Outdated
Comment thread src/laser/core/plotting.py Outdated
Comment thread src/laser/core/plotting.py
Comment thread CHANGELOG.rst Outdated
@clorton
clorton requested a review from jonathanhhb July 14, 2026 16:29

@jonathanhhb jonathanhhb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add input validation at API boundaries in `choropleth()` and
`animate_choropleth()` to reject invalid inputs with clean, actionable
error messages instead of leaking low-level NumPy, matplotlib, or
geopandas exceptions.

New validations:
- Non-numeric columns/values raise `TypeError` naming the dtype
- Ragged `values_by_frame` raises `ValueError` instead of NumPy's
  "setting an array element with a sequence" error
- `log=True` with values `<= -1` raises `ValueError` (log1p undefined
  there) instead of silently plotting `-inf`/`NaN`

Include comprehensive regression tests and improved docstrings.
@clorton
clorton merged commit f744551 into main Jul 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visualize auto generated input data on a choropleth

3 participants