Repository navigation
fix: Blobs.plot_labelbox and plot_box say when a format string has a marker - #270
Merged
Merged
Conversation
…marker
plot_labelbox handed its format string to the base function as well as in the
options, so plot_labelbox('o') failed with 'Unrecognized linestyle', and a
marker on a box failed inside Matplotlib. Pass the options only once, and make
mpl_styling refuse a marker when the artist is a Patch. Re-enable the plot_box
tests that were skipped.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 0 |
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.
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.
Fixes
Blobs.plot_labelbox("o")failing withValueError: Unrecognized linestyle: 'o', and gives a clear error when a format string has a marker for a box. Found while working on the format-string parser (PR 267, merged).The cause.
Blobs.plot_labelboxturned the format string into options withmpl_stylingand also passed the raw string on to the baseplot_labelbox, which hands it to spatialmath'splot_box. That function sorts the characters by hand, and put"o"into the line style. Strings with only a color and a line style ("r--","g") worked, because both paths agreed.The change.
Blobs.plot_labelboxpasses the options once, and no longer passes the string a second time.mpl_stylingrefuses a marker in the format string when the artist is aPatch, because a box cannot draw one:plot_box("r.")andplot_labelbox("o")now sayformat string 'r.' has a marker, which a Patch cannot draw. Before,plot_box("o")failed inside Matplotlib withRectangle.set() got an unexpected keyword argument 'marker'.plot_boxtests that were skipped ("positional fmt argument is broken, upstream PR pending") pass, so I re-enabled them. The cause was fixed in spatialmath some time ago.Tests. A box is drawn with the right edge color and line style for
"r--","g","C1:","orange"and"--"(which keeps the default yellow), for both methods; a marker gives the new error for both;plot_labelboxhas a count test; andmpl_stylinghas a test of the new check. mypy reports no issues and the full suite passes (2267 passed, 30 skipped).AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.
🤖 Generated with Claude Code