Skip to content

fix(graphics): ignore sign of scalar in expand_dims, document reversed limits - #262

Open
petercorke wants to merge 1 commit into
rai-opensource:masterfrom
petercorke:fix/expand-dims-range
Open

petercorke wants to merge 1 commit into
rai-opensource:masterfrom
petercorke:fix/expand-dims-range

Conversation

@petercorke

Copy link
Copy Markdown
Collaborator

A negative scalar passed to expand_dims (and so plotvol2/plotvol3/Animate) gave reversed limits, e.g. -3 -> [3, -3, 3, -3], silently inverting the axes. A scalar is symmetric about zero, so the sign is now ignored via abs().

For the 2/4/6 element forms no min < max check is added. Matplotlib inverts an axis when given reversed limits, so this is a useful way to flip an axis, and expand_dims is a pure function with no axes to call invert_xaxis() on. The docstring now says so.

Adds test_expand_dims.

🤖 Generated with Claude Code

…d limits

A negative scalar previously produced reversed limits (-3 -> [3,-3,...]),
silently inverting the axes. A scalar is symmetric about zero, so use abs().

Document that min > max in the 2/4/6 element forms is passed through and
matplotlib inverts the axis. Add test_expand_dims.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@petercorke
petercorke requested a review from taughz as a code owner October 15, 2026 01:19
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
spatialmath/base/graphics.py 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
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