Skip to content

Feature: Auto-share default with compatibility-aware grouping#560

Draft
cvanelteren wants to merge 10 commits intomainfrom
feat/autoshare-auto-detect
Draft

Feature: Auto-share default with compatibility-aware grouping#560
cvanelteren wants to merge 10 commits intomainfrom
feat/autoshare-auto-detect

Conversation

@cvanelteren
Copy link
Collaborator

Summary

This PR changes default subplot sharing to a compatibility-aware share='auto' mode, while preserving explicit share levels (0..4, aliases) as hard overrides.

The goal is to avoid noisy/inaccurate default sharing for mixed axis families (for example cartesian + polar) and to keep expected shared behavior for compatible grids.

Design Changes

  • Added parsing for share='auto' in Figure (sharex/sharey/share).
  • Added compatibility checks for auto-sharing groups:
    • axis family/projection compatibility (cartesian, polar, geo, external containers)
    • scale compatibility (xscale / yscale)
    • unit/converter domain compatibility
  • Reworked sharing group formation to partition row/column candidates into compatible subgroups.
  • Kept explicit sharing semantics (False/0, labels/1, limits/2, True/3, all/4):
    • explicit modes still attempt sharing and can warn on incompatibility.
  • Added auto-refresh flow for scale changes:
    • in auto mode, scale changes can unshare/re-evaluate groups.
    • after re-grouping, shared groups are autoscaled from sibling data to keep limits consistent.
  • Refactored repeated join/autoscale logic into figure helpers to reduce duplication.

Behavioral Expectations

  • Default behavior (subplots.share='auto'):
    • compatible axes share by default.
    • incompatible mixes are left unshared without warnings.
  • Explicit behavior (share='all', etc.):
    • sharing is forced where requested.
    • incompatible axes emit warning(s) and are skipped.
  • Local axis intent in auto mode:
    • formatting one axis to a different scale can split that axis from its previous share group.
  • Group intent in auto mode:
    • formatting a whole subplot grid preserves sharing and recomputes shared limits from all siblings.

Tests Added

  • default share mode is auto
  • auto mode skips mixed cartesian/polar without warning
  • explicit sharing warns for mixed cartesian/polar
  • auto mode local y-scale change splits group
  • explicit sharey propagates scale changes
  • auto mode grid y-scale change keeps shared limits
  • auto mode mixed x unit domains remain unshared after refresh

Docs Updated

  • API docstring for sharex/sharey/share now documents 'auto' and explicit override semantics.
  • Subplots user guide now documents all explicit levels plus 'auto' and includes a mixed cartesian/polar example.

Out of Scope

  • Full delegation-first share lifecycle redesign.
  • New user-facing API for compatibility policy customization.

@cvanelteren cvanelteren changed the title Auto-share default with compatibility-aware grouping Feature: Auto-share default with compatibility-aware grouping Feb 7, 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