Skip to content

Suppress sharing warnings when no sharing is possible#715

Merged
cvanelteren merged 3 commits into
Ultraplot:mainfrom
kinyatoride:fix-share-zero-polar-warnings
May 12, 2026
Merged

Suppress sharing warnings when no sharing is possible#715
cvanelteren merged 3 commits into
Ultraplot:mainfrom
kinyatoride:fix-share-zero-polar-warnings

Conversation

@kinyatoride
Copy link
Copy Markdown
Contributor

Suppress sharing warnings when no sharing is possible

Problem

UltraPlotWarnings about axis sharing fired in cases where the user did not request sharing or where sharing was not possible at all:

  • uplt.subplots(proj='polar', ncols=2, nrows=3, share=0) — the user explicitly disabled sharing, but construction and every subsequent draw emitted Skipping incompatible y-axis sharing for PolarAxes and PolarAxes: different axis families. and Tick label sharing not implemented for <class 'ultraplot.axes.polar.PolarAxes'> subplots.
  • uplt.subplot(proj='polar') / uplt.subplots(proj='polar') — a single polar axis has nothing to share with, but Tick label sharing not implemented for <PolarAxes> subplots. still fired four times per draw.

Fix

Two unrelated paths needed gating:

  • Axes._apply_auto_share (ultraplot/axes/base.py) called Figure._partition_share_axes for x and y unconditionally. Wrapped the external-share blocks in if self.figure._sharex > 0: / if self.figure._sharey > 0:, mirroring the existing panel-share guards just above.

  • Figure._share_ticklabels (ultraplot/figure.py) ran _compute_baseline_tick_state (which emits the Tick label sharing not implemented warning for unsupported axes types) before checking whether the group could actually share. Skip the group up front when it has fewer than two axes or when no axes have effective share level >= 3.

Explicit share='all' (or any level >= 1) on multiple polar / mixed cart-polar grids still warns as before — that case is informative.

Tests

Added regression tests in ultraplot/tests/test_figure.py:

  • test_share_zero_polar_emits_no_warningsshare=0 on an all-polar grid.
  • test_share_zero_mixed_cartesian_polar_emits_no_warningsshare=0 on a mixed cart/polar grid.
  • test_share_default_single_polar_emits_no_warnings — default share on a single-axis polar figure via uplt.subplots.
  • test_share_default_single_polar_subplot_singular_emits_no_warnings — same via uplt.subplot (singular).

Existing test_explicit_share_warns_for_mixed_cartesian_polar continues to pass, confirming the explicit-share warning path is preserved. All 23 share-related tests pass; broader test_figure.py / test_subplots.py / test_projections.py (139 tests) also pass.

kinyatoride and others added 3 commits May 5, 2026 21:38
…till reapply border masking for supported cartesian and geographic axes, while continuing to suppress no-op warnings for unsupported singleton groups like a lone polar subplot. This restores the guide-related geo ticklabel updates that the broader warning suppression accidentally skipped.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ultraplot/axes/base.py 75.00% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@cvanelteren cvanelteren merged commit 6dad2dc into Ultraplot:main May 12, 2026
18 checks passed
@cvanelteren
Copy link
Copy Markdown
Collaborator

Thanks!

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