Skip to content

refactor: apply the format string once in plot_aligned_box, plot_MEC and plot_MER - #271

Merged
petercorke merged 2 commits into
mainfrom
fix/blobs-single-fmt
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
fix/blobs-single-fmt

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Blobs.plot_aligned_box, plot_MEC and plot_MER read their format string twice: mpl_styling folded it into options, and the same string was also passed to spatialmath's plot_polygon or plot_circle as *args, where plt.plot parsed it again. Since mpl_styling now follows the same rules as plot (PR 267, merged), the second pass adds nothing. This removes it, so each string is read in one place.

No change in behavior. I drew each of the three methods with 12 strings (none, "g", "r--", "--", "r:", "o", "r.", "k-.", "C1", "orange", "bs", "+") before and after the change, and compared the color, line style, marker, line width and line count of what was drawn: all 36 cases are identical. A new test pins nine of them for each method ("o" is markers only, "--" keeps the default yellow), so the two ways of reading the string cannot drift apart again.

Found while looking at plot_labelbox (PR 270, open), which had the same double pass and a bug from it. The other Blobs.plot_* methods pass the string once.

mypy reports no issues and the full suite passes (2261 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

petercorke and others added 2 commits November 24, 2026 07:02
…and plot_MER

The string was folded into the options by mpl_styling and also passed to
spatialmath as *args, so it was parsed twice. The output is the same for every
string tried; pin it with a test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 14 complexity · 0 duplication

Metric Results
Complexity 14
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 merged commit 8bb064c into main Nov 23, 2026
32 checks passed
@petercorke
petercorke deleted the fix/blobs-single-fmt branch November 23, 2026 22:27
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