Skip to content

Let the waterfall plot thin its x labels - #238

Merged
TimoDiepers merged 1 commit into
mainfrom
feature/waterfall-xtick-interval
Sep 17, 2026
Merged

TimoDiepers merged 1 commit into
mainfrom
feature/waterfall-xtick-interval

Conversation

@TimoDiepers

Copy link
Copy Markdown
Member

What

An inventory spanning decades gives plot_characterized_inventory_as_waterfall one bar — and one rotated label — per time step, which stops being readable well before the axis runs out of room. A 50-year use phase produces 51 of them.

xtick_interval=5 labels every fifth step and hides the rest:

plot_characterized_inventory_as_waterfall(tlca, xtick_interval=5)

The default stays None, i.e. every step labelled, so nothing changes for existing code.

The static and prospective columns are not time steps, so they are skipped by the counter and keep their labels whatever the interval is.

Tests

Four cases in tests/test_utils.py against a stub carrying only what the function reads: no interval labels all twelve years, 5 gives 2025/2030/2035, 4 gives 2025/2029/2033, and a fourth asserts static and prospective survive alongside the thinned years.

Worth knowing for anyone writing similar tests: matplotlib drops invisible labels from get_xticklabels() once the figure is drawn, so the assertions compare the visible label texts rather than counting hidden ones.

An inventory spanning decades gives the waterfall one bar, and one rotated
label, per time step, which is unreadable well before the axis runs out of
room. `xtick_interval=5` labels every fifth step and hides the rest.

The `static` and `prospective` columns are not time steps, so they keep their
labels whatever the interval is.
@TimoDiepers
TimoDiepers force-pushed the feature/waterfall-xtick-interval branch from c0be993 to 56b874f Compare September 17, 2026 11:46
@codecov

codecov Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.92%. Comparing base (e567e20) to head (56b874f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
+ Coverage   83.75%   84.92%   +1.17%     
==========================================
  Files          16       16              
  Lines        3760     3767       +7     
==========================================
+ Hits         3149     3199      +50     
+ Misses        611      568      -43     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TimoDiepers
TimoDiepers merged commit 81d1585 into main Sep 17, 2026
11 checks passed
@TimoDiepers
TimoDiepers deleted the feature/waterfall-xtick-interval branch September 17, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant