Skip to content

fix(writer): bars-only errorbar series lost their colour - #14

Merged
BenHuddart merged 3 commits into
mainfrom
fix/errorbar-color-multiseries
Jul 30, 2026
Merged

fix(writer): bars-only errorbar series lost their colour#14
BenHuddart merged 3 commits into
mainfrom
fix/errorbar-color-multiseries

Conversation

@BenHuddart

Copy link
Copy Markdown
Owner

Summary

GLEWriter.add_errorbar emitted the color <NAME> qualifier only from inside its marker branch or its line branch. A bars-only series — no marker and no line, i.e. matplotlib's fmt="none" (also "", " ", "None") — fell through both and produced a bare dataset command (d1 err d2 ...). GLE draws error bars and caps in the dataset's colour, and an unstyled dataset defaults to black, so bars-only series rendered black regardless of the requested colour, at any dataset index and any capsize.

The fix tracks whether marker/line styling already supplied a colour and appends color <NAME> when neither did, matching add_errorbar_from_file's existing marker-less token order (dN color <c> err dM). add_errorbar_from_file did not share the defect — it gained a comment pinning the invariant plus test coverage, no behaviour change. Side benefit: bars-only series now round-trip their colour through open_gle.

Not an index-dependent bug: verified empirically that gleplot has no 8-entry style table and GLE 4.3.10 has no default dN colour cycling — a 40-series script with explicit colours renders all strokes correctly, and unstyled datasets are black from d1.

Test plan

  • New tests/unit/test_errorbar_color.py (30 tests): 12-series bars-only figures at capsize=0 and capsize=4 asserting per-series colours on generated GLE text through double-digit dataset indices; all four "no line, no marker" fmt spellings; asymmetric errup/errdown + herr; marker/line/line+marker branches; errorbar_from_file both branches; and a blanket invariant that no err-referencing command lacks a colour. 11 of 30 fail against the pre-fix writer.
  • Full suite green: 1473 passed, 2 skipped (pre-existing).
  • Visual verification via GLE 4.3.10: 12-series bars-only figure black before, per-series colours after; EPS stroke audit confirms bars and caps both coloured, only axis ticks remain black.

🤖 Generated with Claude Code

BenHuddart and others added 3 commits July 30, 2026 13:09
``Writer.add_errorbar`` only emitted the ``color`` qualifier from inside
the marker branch or the line branch. A bars-only series -- matplotlib's
``fmt="none"`` (also ``""``, ``" "``, ``"None"``), i.e. no marker and no
line -- therefore produced an unstyled ``dN err dM`` command. GLE draws
error bars and their caps in the dataset's colour and an unstyled dataset
defaults to black, so every such series rendered black bars regardless of
the requested colour, at any dataset index and for any capsize (including
``capsize=0``).

Emit ``color <name>`` whenever the marker/line styling did not already
supply one, matching ``add_errorbar_from_file``'s marker-less token order
(``dN color <c> err dM``).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Regression coverage for the bars-only errorbar defect: 12-series figures
(so the assertions reach double-digit dataset indices, where the black bars
were first noticed) check that each emitted errorbar command carries its
own series colour, plus a blanket invariant that no command referencing
err/errup/errdown/herr is left without a colour. Covers capsize=0 and
capsize>0, every "no line, no marker" fmt spelling, asymmetric and
horizontal errors, the marker/line branches, and errorbar_from_file.

11 of these fail against the previous writer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Records the invariant the writer now guarantees, including the bars-only
(fmt='none') and capsize=0 cases where the colour used to be dropped.
docs/CHANGELOG.md is left alone -- python-semantic-release owns it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BenHuddart
BenHuddart merged commit 918dc31 into main Jul 30, 2026
4 checks passed
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