Skip to content

fix: consume Matplotlib format markers - #144

Merged
petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/matplotlib-format-markers
Oct 17, 2026
Merged

petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/matplotlib-format-markers

Conversation

@RoboX2020

Copy link
Copy Markdown
Contributor

The compact-format parser recognizes a marker but leaves it in working_fmt, so valid strings such as 'o', 'ro--', 'g^:' and '-.b*' raise ValueError as unrecognized components.

Remove the matched marker once, like the color and linestyle, before checking for leftover characters. Invalid duplicate markers and unmatched characters still raise.

Added nine checks covering the documented combined formats, a marker alone, tuple input, keyword precedence, and invalid leftovers. Six fail on the original implementation. The valid-format tests also create a Matplotlib line and check its marker.

Validation on Python 3.11:

  • New tests: 9 passed on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full OpenCV 5 suite: 968 passed, 97 skipped, 5 subtests passed.
  • Test file passes ruff and black.
  • Inspected a headless render of the three combined formats: red circles/dashes, green triangles/dots, and blue stars/dash-dot lines.

Full suite on OpenCV 4 and a desktop GUI were not run. This is a one-line production fix, not an extension of the accepted format syntax.

Check marker formats, tuple input, option precedence and rejection of unmatched characters.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke petercorke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Great catch

@petercorke
petercorke merged commit bcf63e4 into petercorke:main Oct 17, 2026
39 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 17, 2026
@petercorke

Copy link
Copy Markdown
Owner

Thanks — good catch on the marker never being consumed from the format string. Merged.

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.

2 participants