Suppress sharing warnings when no sharing is possible#715
Open
kinyatoride wants to merge 1 commit intoUltraplot:mainfrom
Open
Suppress sharing warnings when no sharing is possible#715kinyatoride wants to merge 1 commit intoUltraplot:mainfrom
kinyatoride wants to merge 1 commit intoUltraplot:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 subsequentdrawemittedSkipping incompatible y-axis sharing for PolarAxes and PolarAxes: different axis families.andTick 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, butTick 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) calledFigure._partition_share_axesfor x and y unconditionally. Wrapped the external-share blocks inif 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 theTick label sharing not implementedwarning 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_warnings—share=0on an all-polar grid.test_share_zero_mixed_cartesian_polar_emits_no_warnings—share=0on a mixed cart/polar grid.test_share_default_single_polar_emits_no_warnings— default share on a single-axis polar figure viauplt.subplots.test_share_default_single_polar_subplot_singular_emits_no_warnings— same viauplt.subplot(singular).Existing
test_explicit_share_warns_for_mixed_cartesian_polarcontinues to pass, confirming the explicit-share warning path is preserved. All 23 share-related tests pass; broadertest_figure.py/test_subplots.py/test_projections.py(139 tests) also pass.