Skip to content

Fix PolarAxes.format() silently dropping xlabel/ylabel#713

Open
kinyatoride wants to merge 1 commit into
Ultraplot:mainfrom
kinyatoride:fix-polar-format-xlabel-ylabel
Open

Fix PolarAxes.format() silently dropping xlabel/ylabel#713
kinyatoride wants to merge 1 commit into
Ultraplot:mainfrom
kinyatoride:fix-polar-format-xlabel-ylabel

Conversation

@kinyatoride
Copy link
Copy Markdown
Contributor

Summary

ax.format(xlabel=..., ylabel=...) had no effect on polar axes (e.g. for Taylor-diagram-style figures), even though ax.set_xlabel(...) worked. PolarAxes.format() did not declare xlabel/ylabel parameters and base.Axes.format() does not handle them — only CartesianAxes.format() did.

This PR:

  • Adds an _update_labels helper to PolarAxes mirroring the CartesianAxes one, and wires xlabel, ylabel, xlabel_kw, ylabel_kw through the existing (x, y) loop so they are forwarded to matplotlib's set_xlabel/set_ylabel.
  • Fixes a dispatcher limitation in Figure.format() exposed by the change: _pop_params previously popped each kwarg into the first matching class signature, so when called via SubplotGrid.formatFigure.format on a polar axes, xlabel was routed to kws[CartesianAxes] and never applied. Switched to a non-popping collector so shared params reach every matching class signature; the unused-warning is updated so shared keys consumed by any matched class don't trigger a false warning.
  • Adds a regression test in test_projections.py.

Test plan

  • pytest ultraplot/tests/test_projections.py -k polar — new and existing polar tests pass
  • pytest ultraplot/tests/test_format.py — no regressions
  • Full suite: 523 passed (1 unrelated failure in test_docs_fetch_releases)
  • Smoke test: ax.format(xlabel='Radius', ylabel='Angle', labelpad=15, labelcolor='red', xlabel_kw={'weight': 'bold'}) renders correctly with per-axis-kw override

@cvanelteren
Copy link
Copy Markdown
Collaborator

Out of town atm can look at this when I'm back.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cvanelteren
Copy link
Copy Markdown
Collaborator

My initial read on this was that xlabel and ylable makes no sense for PolarAxesbut as I understand it you want to work towards making a Taylor diagram directly which you would then have x and ylabels which are currently being filtered out. Am I correctin this?

@cvanelteren
Copy link
Copy Markdown
Collaborator

If yes then my issue would be that Taylor diagrams probably need a new axis type as it does not make sense to have x and y labels for polar axes (as they don't exist).

@cvanelteren cvanelteren added the question Further information is requested label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants