Repository navigation
v0.2: diverging metrics (time or money saved, either sign), missing values in grey, a comparison example - #3
Merged
Merged
Conversation
For a difference that can be either sign, such as door-to-door time saved by one option against another. Backwards compatible: a 0.1 spec draws the same pages. - colour.diverging() and colour.diverging_norm(lo, hi, centre); legends mark both clipped ends. A NaN is colour.MISSING grey on every metric. - Metric.cmap takes a Colormap; Metric.note says what the colours mean (default "darker is higher (log scale)", as before). - 3D column height is the value's size either sign. - fmt.signed(unit, digits) with a true minus sign. - examples/synthetic_comparison.py: made-up cities, a new service against the faster alternative, the car and air; binning a non-additive saving as people x hours over people. Tested end to end. 20 tests pass; ruff clean. Both pages checked in a browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suggested by Dr. Jones (2026-09-28) after the HSR door-to-door maps: time saved by one option against another is a difference that can be either sign, and v0.1 only had sequential log scales. This adds a diverging scale and an example. Everything uses synthetic data only, as the repo's rules require.
What changes
colour.diverging()gives orange below the centre, a pale middle and blue above.colour.diverging_norm(lo, hi, centre=0)sets the scale. Legends mark both clipped ends (≤,≥).colour.MISSING, per metric. So "against air" can be grey where no airport is in reach, while the same hexagon stays coloured under "against the car".Metric.cmapalso accepts a Colormap.Metric.noteputs the colour meaning on the legend. Its default reproduces v0.1's "darker is higher (log scale)", so existing specs draw identical pages.fmt.signed(unit, digits)formats values like "+0.4 h" and "−1.2 h", with a true minus sign.examples/synthetic_comparison.pyuses two made-up cities, a town with no airport, and a new service between the cities. It has three metrics (against the faster alternative, the car, air) and two views (trips each way). It also shows how to bin a quantity that is not additive: sum people × hours and people, then divide.Version is 0.2.0, with the CHANGELOG and README updated.
Checked
ruff checkis clean.After merge
Please tag
v0.2.0.hsr-robotaxi-scenariospins this branch's commit until the tag exists, then moves to the tag.🤖 Generated with Claude Code