fix(writer): bars-only errorbar series lost their colour - #14
Merged
Conversation
``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>
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.
Summary
GLEWriter.add_errorbaremitted thecolor <NAME>qualifier only from inside its marker branch or its line branch. A bars-only series — no marker and no line, i.e. matplotlib'sfmt="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, matchingadd_errorbar_from_file's existing marker-less token order (dN color <c> err dM).add_errorbar_from_filedid 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 throughopen_gle.Not an index-dependent bug: verified empirically that gleplot has no 8-entry style table and GLE 4.3.10 has no default
dNcolour cycling — a 40-series script with explicit colours renders all strokes correctly, and unstyled datasets are black from d1.Test plan
tests/unit/test_errorbar_color.py(30 tests): 12-series bars-only figures atcapsize=0andcapsize=4asserting per-series colours on generated GLE text through double-digit dataset indices; all four "no line, no marker"fmtspellings; asymmetricerrup/errdown+herr; marker/line/line+marker branches;errorbar_from_fileboth branches; and a blanket invariant that noerr-referencing command lacks a colour. 11 of 30 fail against the pre-fix writer.🤖 Generated with Claude Code