Skip to content

feat: style the label of Blobs.plot_centroid and each axis of Blobs.plot_axes - #269

Merged
petercorke merged 2 commits into
mainfrom
feat/blobs-style-args
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
feat/blobs-style-args

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Adds style arguments to two Blobs plot methods, following the <thing>_style convention discussed in rvc-ecosystem Issue 15 (open).

  • plot_centroid(text_style=...). The label=True text could not be styled. text_style is a dict of Matplotlib text options (dict(color="white", fontsize=12)), passed to plot_point as textargs.
  • plot_axes(major_style=..., minor_style=...). One set of kwargs styled both axes, so they could not be styled separately. Each axis now has its own dict. The options merge in this order, later winning: the default (new module constants MAJOR_AXIS_STYLE, red, and MINOR_AXIS_STYLE, green, both linewidth 2), the format string, kwargs (still applied to both axes), and then major_style or minor_style. Existing calls behave as before.
  • Empty text removed. Without label, plot_centroid passed an empty string as the text, which added an empty text artist for every blob. It now passes none.

The other Blobs.plot_* methods each draw one thing and forward *args, **kwargs, so they stay as they are.

Both changes have .. versionchanged:: 2.5.0.

Tests: 10 new, covering the default axis colors, the two spellings of an option, kwargs applying to both axes, each style alone, precedence (style over kwargs over format string), the module defaults not being changed, and text_style with and without label. mypy reports no issues and the full suite passes (2254 passed, 33 skipped).

The styles and kwargs may spell an option differently (lw=3 in kwargs and linewidth=5 in major_style), because both go through mpl_styling(..., artist=Line2D) from PR 266 (merged) before they are merged.

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 06:37
…lot_axes

Add text_style to plot_centroid and major_style and minor_style to plot_axes,
following the <thing>_style convention of rvc-ecosystem Issue 15. The axis
defaults become module constants. plot_centroid no longer adds an empty text
artist per blob when label is False.

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

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 12 complexity · 0 duplication

Metric Results
Complexity 12
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 d972f53 into main Nov 23, 2026
32 checks passed
@petercorke
petercorke deleted the feat/blobs-style-args branch November 23, 2026 21:09
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
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